摘要: import urllib.request url = 'http://www.baidu.com/' response = urllib.request.urlopen(url) data = response.read() str_data = data.decode('utf_8') # print(str_data) with open('baidu.html','w',encodin... 阅读全文
posted @ 2018-11-08 16:48 徐李帅 阅读(2171) 评论(0) 推荐(0) 编辑
摘要: import urllib.request import random import re import json ''' 解决访问403的问题,需要模仿浏览器访问 ''' my_headers = [ "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171... 阅读全文
posted @ 2018-11-08 16:48 徐李帅 阅读(205) 评论(0) 推荐(0) 编辑