__author__ = 'mocy'
#coding:UTF-8
import urllib.request
import io
import sys
# #改变python3默认输出编码
sys.stdout = io.TextIOWrapper(sys.stdout.buffer,encoding='gb18030')
resp = urllib.request.urlopen('http://www.baidu.com')
print(resp.read().decode('utf-8'))#获取相应体内容
#获取相应信息（状态码  头信息）
print(resp.status,resp.getheaders())


9013f619c3fba2773318328911f0835aeca1d5c5
<mask token>

<mask token>
print(resp.read().decode('utf-8'))
print(resp.status, resp.getheaders())

__author__ = 'mocy'
<mask token>
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='gb18030')
resp = urllib.request.urlopen('http://www.baidu.com')
print(resp.read().decode('utf-8'))
print(resp.status, resp.getheaders())

__author__ = 'mocy'
import urllib.request
import io
import sys
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='gb18030')
resp = urllib.request.urlopen('http://www.baidu.com')
print(resp.read().decode('utf-8'))
print(resp.status, resp.getheaders())

__author__ = 'mocy'
#coding:UTF-8
import urllib.request
import io
import sys
# #改变python3默认输出编码
sys.stdout = io.TextIOWrapper(sys.stdout.buffer,encoding='gb18030')
resp = urllib.request.urlopen('http://www.baidu.com')
print(resp.read().decode('utf-8'))#获取相应体内容
#获取相应信息（状态码  头信息）
print(resp.status,resp.getheaders())

