import zipfile
A = zipfile.ZipFile("A.zip", "w")
A.write("12345.txt")
A.close()
How do I set password to compressed zip files in Python?
http://answers.yahoo.com/question/index ... 151AAJER9ZPython's zipfile module can only decrypt ZIP archives, it can't create encrypted ZIP archives. (The documentation for the zipfile module at http://docs.python.org/library/zipfile.h... says "[This module] supports decryption of encrypted files in ZIP archives, but it currently cannot create an encrypted file".) The only use for the setpassword() method is to provide the password that will be used to decrypt.
BTW, to allow Yahoo Answers to wrap a long line rather than truncating it, sprinkle some spaces into the line.