binascii.Error: Invalid base64-encoded string: number of data characters (25) cannot be 1 more than a multiple of 4
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