原文:AttributeError: 'str' object has no attribute 'decode'

python 下列代碼會報上邊的錯 print Response: , resp.text.decode unicode escape 解決辦法:print Response: , resp.text.encode utf .decode unicode escape 中間加上.encode utf 即可。 問題原因:python 里面,字符串要先encode手動指定其為某一編碼的字節碼之后,才能 ...

2020-08-10 10:23 0 888 推薦指數:

查看詳情

AttributeError: 'str' object has no attribute 'decode'

python3下列代碼會報上邊的錯 print("Response:", resp.text.decode('unicode_escape'))解決辦法:print("Response:", resp.text.encode('utf-8').decode('unicode_escape ...

Wed Sep 25 06:49:00 CST 2019 0 18837
 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM