import base64 str1 = "hello word" str2 = str1.encode(encoding ='utf-8',errors = 'strict') str3 = base64.b64encode(str2) str4 = str3.decode()
enstr = base64.b64decode(str3.decode()) print(enstr.decode())