亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

求大神解答為什么報錯

#?-*-?coding:?utf-8?-*
from?bs4?import?BeautifulSoup

html_doc?=?"""
<html><head><title>The?Dormouse's?story</title></head>
<body>
<p?class="title"><b>The?Dormouse's?story</b></p>

<p?class="story">Once?upon?a?time?there?were?three?little?sisters;?and?their?names?were
<a?>Elsie</a>,
<a?>Lacie</a>?and
<a?>Tillie</a>;
and?they?lived?at?the?bottom?of?a?well.</p>

<p?class="story">...</p>
"""

soup?=?BeautifulSoup(html_doc,?'html.parser',?from_encoding='utf-8')

links?=?soup.find_all('a')

for?link?in?links():
????print?link.name,link['href'],link.get_text()


Traceback (most recent call last):

? File "E:/scripts/Test/venv/why.py", line 22, in <module>

? ? for link in links():

TypeError: 'ResultSet' object is not callable


正在回答

1 回答

? ?for link in links:

你多了個括號

1 回復 有任何疑惑可以回復我~
#1

Triumph__ 提問者

感謝!
2018-12-09 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消
Python開發簡單爬蟲
  • 參與學習       227596    人
  • 解答問題       1288    個

本教程帶您解開python爬蟲這門神奇技術的面紗

進入課程

求大神解答為什么報錯

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號