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
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