python网页全部内容的获取

python网页全部内容的获取

1、升级pip的版本

2、安装requests包

3、前两步才可以引用requests包

例子

import requests
res = requests.get(‘http://news.sina.com.cn/china/xlxw/2018-01-17/doc-ifyqrewi9270282.shtml’)
res.encoding = ‘utf-8’
print(res.text)

猜你喜欢

转载自www.cnblogs.com/gome5/p/12178160.html