import base64
s = '人生苦短!'
# 加密
b = base64.b64encode(s.encode('utf-8'))
print(b)
# 解密
c = base64.b64decode(b).decode('utf-8')
print(c)
from base64 import b64encode, b64decode
s = 'I love python!'
s_encode_base64 = b64encode(s.encode(encoding='utf-8'))
s_decode = b64decode(s_encode_base64).decode(encoding='utf-8')
print(s_decode)