赞
踩
# -*- coding:utf-8 -*- import csv import io import sys sys.stdout = io.TextIOWrapper(sys.stdout.buffer,encoding='gb18030') import requests from bs4 import BeautifulSoup # 导入所需库 # 请求头部 headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:58.0) Gecko/20100101 Firefox/58.0'} def get_top(url): # 获取单页 respose = requests.get(url, headers=headers) respose.encoding="gb18030" soup = BeautifulSoup(respose.text, 'lxml') # '景点' names = soup.
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。