When using the python module zipfile
, for some reason I don't know I can't set a password for an archive created.
When trying to unzip following empty zip archive, I can do so without prompting a password..
Here is my code, what's wrong?
import zipfile
with zipfile.ZipFile("1.zip","w") as zip:
zip.setpassword("1234")
From documentation for zipfile module
It supports decryption of encrypted files in ZIP archives, but it currently cannot create an encrypted file.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.