中国天气网数据爬取(全部)
import requests
from bs4 import BeautifulSoup
from pyecharts import Bar#表格库
def main():
urls = [
‘http://www.weather.com.cn/textFC/hb.shtml’,'http://www.weather.com.cn/textFC/db.shtml’,
‘http://www.weather.com.cn/textFC/hd.shtml’,'http://www.weather.com.cn/textFC/hz.shtml’,
‘http://www.weather.com.cn/textFC/hn.shtml’,'http://www.weather.com.cn/textFC/xb.shtml’,
‘http://www.weather.com.cn/textFC/xn.shtml’,'http://www.weather.com.cn/textFC/gat.shtml’
]
for url in urls:
parse_data(url)
抓取和解析数据
all_data = [ ]
def parse_data(url):