2020 最新 Python3.8 爬国家统计局区域、省、市、区街道乡镇代码
import urllib.request import time from bs4 import BeautifulSoup indexs = 'index.html' url = 'http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/2019/' txt = urllib.request.urlopen(url + indexs).read().decode('gbk') soup = BeautifulSoup(txt, 'html.parser') lista = soup.find_all('a') lista.pop() for a i
用户评论