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

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

問一下19行intended block是為什么

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?>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')

print('獲取所有鏈接')

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

for?link?in?links:

print?(link.name,?link['href'],?link.get_text())

最后一行顯示intended block



正在回答

1 回答

你將最后一行縮進一下,與for循環行程層次關系

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


0 回復 有任何疑惑可以回復我~

舉報

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

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

進入課程

問一下19行intended block是為什么

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

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

幫助反饋 APP下載

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

公眾號

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