python---base64 编码

import base64

s = "askjdfejhkwfwejhk"
#base编码,把字符串变成base64的结果
result = base64.b64encode(s.encode()) #变成b64类型
print(result.decode()) #变成字符串

b64_str="5L2g5aW95ZOl5piv5Liq5rex5rex5Zyw5oSf5Y+X5Yiw" #解密
ret = base64.b64decode(b64_str)
print(ret.decode())
posted @ 2021-10-23 09:56  王王的王  阅读(88)  评论(0)    收藏  举报