liehuop 发表于 2017-10-16 19:34

puthon中zipfile设置密码问题

设置密码总是报错,不设置密码是ok的
import zipfile
pwd=bytes('123456',encoding="utf8")
zipfile.ZipFile.setpassword(pwd)

f=zipfile.ZipFile("archive.zip","w",zipfile.ZIP_DEFLATED)
#要压缩的文件
f.write("a.txt")
f.close()

liehuop 发表于 2017-10-17 10:05

刚看了下官方文档,zipfile supports description of encrypted files in ZIP archives,but it currently cannot create an encrypted file
页: [1]
查看完整版本: puthon中zipfile设置密码问题