【发布时间】:2016-12-18 19:24:33
【问题描述】:
大家好,我在爬网时遇到了一些困难。我正在尝试在嵌入在一些 html 中间的这段代码中获取 70,我的问题是我将如何去做。我尝试了各种方法,但似乎都没有。我正在使用 BeautifulSoup 模块并用 Python 3 编写。如果有人需要,我正在抓取的网站的链接很方便地是 href 中的链接。提前谢谢你。
<a href="http://www.accuweather.com/en/gb/london/ec4a-2/weather- forecast/328328">London, United Kingdom<span class="temp">70°</span><span class="icon i-33-s"></span></a>
from bs4 import*
import requests
data = requests.get("http://www.accuweather.com/en/gb/london/ec4a-2/weather- forecast/328328")
soup = BeautifulSoup(data.text,"html.parser")
【问题讨论】:
标签: python beautifulsoup web-crawler href