import base64 password = '123456lyp' later = base64.b64encode(password.encode('utf-8')) print(later) later1 = str(later, 'utf-8') print(later1) print(str(base64.b64decode(later1), 'utf-8'))