python base64加密解密
import base64 str_A = "待加密的字符串AABBCC" eStr_A = base64.b64encode(str_A.encode()) print(eStr_A) # b'5b6F5Yqg5a+G55qE5a2X56ym5LiyQUFCQkND' dStr_A = base64.b64decode(eStr_A).decode() print(dStr_A) # 待加密的字符串AABBCC
若解密出现乱码,可检查下加密字符串中是否有特殊符号,如$替换成+后解密即可。
本文来自博客园,作者:OTAKU_nicole,转载请注明原文链接:https://www.cnblogs.com/nicole-zhang/p/14986578.html