欢迎光临
我们一直在努力

TypeError: Unicode-objects must be encoded before hashing

概述

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

赞(0)
未经允许不得转载:莱卡云 » TypeError: Unicode-objects must be encoded before hashing