美文网首页
python爬虫(1)-helloworld

python爬虫(1)-helloworld

作者: 初灬终 | 来源:发表于2017-11-27 19:23 被阅读10次

环境:python3.6
工具:PyCharm
目标:爬取一个HTML页面(先不考虑JavaScript,CSS等)

import requests

req = requests.get('http://chuanyuezhe.yetianzi.com')
#解决编码问题
req.encoding = 'utf-8'
file = open('/tmp/xiaoshuo.html', 'w')
file.write(req.text)
file.close()

相关文章

网友评论

      本文标题:python爬虫(1)-helloworld

      本文链接:https://www.haomeiwen.com/subject/ufadbxtx.html