TypeError: Unicode-objects must be encoded before hashing


python3中md5報錯

>>> import hashlib
>>> md5 = hashlib.md5()
>>> md5.update("123")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: Unicode-objects must be encoded before hashing

  • 正確方法

python3中字符對象是unicode對象,不能直接加密

md5.update("123".encode("utf-8"))

《壽康寶鑒》有聲書
壽康寶鑒百話有聲書(mp3)
百度網盤  https://pan.baidu.com/s/1rs5k7RTB9DxgdCuG-mSzog  密碼 9lf1




免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM