概述
import hashlib
Login_Pawd='123456'
hashlib.md5(Login_Pawd).hexdigest()
在Python3执行字符串转Md5时报错 “TypeError: Unicode-objects must be encoded before hashing”
解决方法
在值后面加入.encode(“utf-8”)即可
import hashlib
Login_Pawd='123456'
hashlib.md5(Login_Pawd.encode("utf-8")).hexdigest()
文章来源于互联网:TypeError: Unicode-objects must be encoded before hashing