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

Wenn du dir nicht sicher bist, in welchem der anderen Foren du die Frage stellen sollst, dann bist du hier im Forum für allgemeine Fragen sicher richtig.
Antworten
fox12345
User
Beiträge: 16
Registriert: Donnerstag 3. Oktober 2013, 08:46

import zipfile
A = zipfile.ZipFile("A.zip", "w")
A.write("12345.txt")
A.close()
Dami123
User
Beiträge: 225
Registriert: Samstag 23. Februar 2013, 13:01

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
Hellstorm
User
Beiträge: 231
Registriert: Samstag 22. Juni 2013, 15:01

@fox12345:

It is usually considered good manners to say something like "Hello, can you help me" or "Thank you in advance".
fox12345
User
Beiträge: 16
Registriert: Donnerstag 3. Oktober 2013, 08:46

Thank you for all replies...
Antworten