how to encode and decode a string in python 3 by base64 code example Example: decode base64 python import base64 msg = base64.b64decode(msg)