I would recommend using the pickle library with the protocol set to 2. This is a binary format that should be unreadable in a text editor.
Mind you, this means that any Python program that uses your class can still un-pickle and read it. For added security, I would suggest looking into one-way cryptographic hashes (such as SHA224 or MD5) as a way of making the password unreadable: since you only need to confirm that the input password matches the stored one, you only need compare the hash of the password to the hash of the input. This makes it so that you don't need to store the password in a form that can be restored at all. This is in fact how virtually every password system in use today works, AFAIK.