python3之base64编码、解码

代码:

import base64
str = "haha"
str1 = base64.b64encode(str.encode("utf8")).decode("utf-8") #base64编码
print(str1)#输出aGFoYQ==

print(base64.b64decode(str1).decode("utf-8")) #base64解码,输出haha
posted @ 2020-12-28 22:57  亨利其实很坏  阅读(916)  评论(0)    收藏  举报