pip install chardet
查编码的包
import urllib import chardet if __name__ == '__main__': response = urllib.urlopen("http://10.88.99.123:50039/") html = response.read() characterset=chardet.detect(html) print('**************************************源码输出*********************************************') print(html) print('**************************************转码输出*********************************************') htmltransfer= html.decode("utf-8") print(htmltransfer) print('**************************************查编码格式*********************************************') characterset = chardet.detect(html) print(chardet)