Python学习–第六天

kk24430 18 0 PDF 2020-12-22 23:12:14

一、通过urllib库爬取网站的源码 方法一:直接爬取(没有限制的情况下) import urllib.request response = urllib.request.urlopen('http://chongqingtravel.cn/') print(response.read().decode('utf-8')) print(response.getheader('Server'))#web服务器类型 运行结果: "F:\Python 3.8.0\python.exe" ****** nginx Process finished with exit code 0 方法

用户评论
请输入评论内容
评分:
暂无评论