简单应用下,日后需要再完善。
简单例子:

import base64

# base64加密
str_a = 'Python base64模块'
b = base64.b64encode(str_a.encode()) # 传入的是字节,需要encode()编码,不然报错TypeError: a bytes-like object is required, not 'str'
print(b,type(b))
print(b.decode())

# base64解密
c= base64.b64decode(b)
print(c,type(c))
print(c.decode())