标签:
urllib.request
import urllib.request as ur url=‘http://ie.icoa.cn‘ user_agent = ‘Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)‘ req=ur.Request(url) req.add_header(‘User-Agent‘,user_agent) res=ur.urlopen(req) html=res.read().decode(‘utf8‘) print(html)
发送一个header,模拟浏览器
标签:
原文地址:http://www.cnblogs.com/fj0716/p/5138391.html