binascii.Error: Invalid base64-encoded string: number of data characters (25) cannot be 1 more than a multiple of 4
时间:2019-04-11 12:52:10
收藏:0
阅读:4754
Python Django 中set_cookie get_cookie 出现这种错误
b‘5Lit5paHdXRmLTjljrvmjoli‘ 打印看多了个b ,bytes
解决:
data1=base64.b64encode(‘中文utf-8去掉b‘.encode()).decode()
现在打印看,去掉了b了...
5Lit5paHdXRmLTjljrvmjoli
user_id=request.COOKIES.get(‘user_id‘)
user_id=base64.b64decode(user_id)
原文:https://www.cnblogs.com/--A--/p/10688840.html
评论(0)