python爬虫,第一步

通过python获取到网页:
这里是获取的百度

import urllib.request  #导入包
response = urllib.request.urlopen("https://www.baidu.com")  #设置目标链接
html = response.read()  #将得到的目标网页读取出来
html = html.decode("utf-8")  通过转码,以正常格式显示出来
print(html)

猜你喜欢

转载自blog.csdn.net/ykallan/article/details/86105393