python3 requests請求response.text返回\u 16進制數字,轉換中文.

返回\u 16進制數字

reponse.content.decode("unicode_escape")

返回亂碼中文

獲取網站原始編碼
print(requests.utils.get_encodings_from_content(r.text)[0])
設置編碼: r.encoding= requests.utils.get_encodings_from_content(r.text)[0]
打印: print(r.text)

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章