from urllib.request import urlopen

#要访问的地址
url = 'http://www.baidu.com/'

#发送请求
response = urlopen(url)

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

#打印内容
# print(info.decode())


#返回HTTP的响应码
print(response.getcode())

#返回实际访问的url
print(response.geturl())

#返回HTTP响应的报头
print(response.info())
743da6e4d57989271c2d79daad7000b608f3ab75
<mask token>

<mask token>
print(response.getcode())
print(response.geturl())
print(response.info())

<mask token>
url = 'http://www.baidu.com/'
response = urlopen(url)
info = response.read()
print(response.getcode())
print(response.geturl())
print(response.info())

from urllib.request import urlopen
url = 'http://www.baidu.com/'
response = urlopen(url)
info = response.read()
print(response.getcode())
print(response.geturl())
print(response.info())

from urllib.request import urlopen

#要访问的地址
url = 'http://www.baidu.com/'

#发送请求
response = urlopen(url)

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

#打印内容
# print(info.decode())


#返回HTTP的响应码
print(response.getcode())

#返回实际访问的url
print(response.geturl())

#返回HTTP响应的报头
print(response.info())