【发布时间】:2019-11-04 21:08:07
【问题描述】:
我想从 html 中抓取数据并将其保存到文本文件中我有 URL 请你 如果 JavaScript 或 python 更可取,我可以尝试
# Import libraries
import requests
import urllib2
import time from bs4
import BeautifulSoup
# Set the URL you want to webscrape from
url = 'theweathernetwork.com/ca/hourly-weather-forecast/ontario/london'
# Connect to the URL
response = requests.get(url)
# Parse HTML and save to BeautifulSoup object
soup = BeautifulSoup(response.text, "html.parser")
# To download the whole data set, let's do a for loop through all a tags
【问题讨论】:
-
你能展示一些你已经尝试过的东西吗?
-
我没有尝试任何东西我正在谷歌搜索
-
我可以把网址和我想提取的数据发给你
-
首先,研究您的问题。然后,如果您没有找到答案,请在此处使用您已经尝试过的代码提出问题
-
嘿@MaryMekhael,欢迎来到stackoverflow!请查看stackoverflow.com/help/how-to-ask。您应该尝试更准确地描述您正在尝试做的事情。
标签: javascript python web-scraping beautifulsoup