Seite 1 von 1

How do I set password to compressed zip files in Python?

Verfasst: Samstag 12. Oktober 2013, 05:14
von fox12345
import zipfile
A = zipfile.ZipFile("A.zip", "w")
A.write("12345.txt")
A.close()

Re: How do I set password to compressed zip files in Python?

Verfasst: Samstag 12. Oktober 2013, 06:10
von Dami123
Python'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.
http://answers.yahoo.com/question/index ... 151AAJER9Z

Re: How do I set password to compressed zip files in Python?

Verfasst: Samstag 12. Oktober 2013, 06:32
von Hellstorm
@fox12345:

It is usually considered good manners to say something like "Hello, can you help me" or "Thank you in advance".

Re: How do I set password to compressed zip files in Python?

Verfasst: Samstag 12. Oktober 2013, 09:17
von fox12345
Thank you for all replies...