python 3.x urllib学习
生活随笔
收集整理的这篇文章主要介绍了
python 3.x urllib学习
小编觉得挺不错的,现在分享给大家,帮大家做个参考.
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,模拟浏览器
转载于:https://www.cnblogs.com/fj0716/p/5138391.html
总结
以上是生活随笔为你收集整理的python 3.x urllib学习的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: Hive Fetch Task
- 下一篇: Python~第三方模块