[英]Setting a password with python's zipfile module
When using the python module zipfile
, for some reason I don't know I can't set a password for an archive created. 当使用python模块
zipfile
,由于某种原因,我不知道我无法为创建的存档设置密码。
When trying to unzip following empty zip archive, I can do so without prompting a password.. 尝试对空的zip存档进行解压缩时,无需输入密码即可执行此操作。
Here is my code, what's wrong? 这是我的代码,怎么了?
import zipfile
with zipfile.ZipFile("1.zip","w") as zip:
zip.setpassword("1234")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.