Crawler quick start-simply crawl data

Directly upload the code, the explanation is in the comments, if you don’t understand the comments, you must reply

#项目名称:
#项目简介:
#作   者:key
#开发时间:2020/10/24 17:13

from urllib.request import urlopen

url = 'http://www.baidu.com'

#发送消息
response = urlopen(url)

#读取内容
info = response.read()

#打印状态码
print(response.getcode())

#打印真实url
print(response.geturl())

#打印响应头
print(response.info())


Guess you like

Origin blog.csdn.net/weixin_43402353/article/details/109264216