ISO-9959-1的问题
直接上干货
import reimport requestsnew_url = "http://www.anquan.us/static/drops/papers-17213.html"res = requests.get(url=new_url).content.decode('utf-8')print (res)"""if res.encoding == 'ISO-8859-1':encodings = requests.utils.get_encodings_from_content(res.text)if encodings:encoding = encodings[0]else:encoding = res.apparent_encodingelse:encoding = res.encodingencode_content = res.content.decode(encoding, 'replace').encode('utf-8', 'replace').decode('utf-8')"""#print(encode_content)#print(res.encoding)#print(res.apparent_encoding)#print(requests.utils.get_encodings_from_content(res.text))