import requests from bs4 import BeautifulSoupall_url = ‘http://www.7160.com/qingchunmeinv/‘ # 请求头 header = { ‘User-Agent‘: ‘Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 UBrowser/6.1.2107.204 Safari/537.36‘ } start_html = requests.get(all_url,headers = header) html = start_html.text.encode(‘iso-8859-1‘).decode(‘gbk‘) # 将gb2312转为UTF-8格式 print(html)
原文地址:https://www.cnblogs.com/zhuifeng-mayi/p/9707091.html
时间: 2024-10-09 15:02:07