简单实现一个获取网页
#coding:utf-8
from urllib import request
if __name__=='__main__':
response = request.urlopen('http://www.csdn.net')
html=response.read()
print(html)
获取网页编码
#coding:utf-8
from urllib import request
import chardet
if __name__=='__main__':
response = request.urlopen('http://www.csdn.net')
html=response.read()
charset = chardet.detect(html)
print(charset)