[最佳答案] If you just want to prevent casually glancing at a password, you may want to consider encoding/decoding the password to/from base64. It's not secure in the least, but the password won't be casually human/robot readable. import base64 # Encode password encoded_pw = base64.b64encode(raw_pw) # Decode password decoded_pw = base64.b64decode(encoded_pw)