六位数字的密码就可以,但是五位数字的密码就输出False,这是为什么啊?
infile = zipfile.ZipFile('test.zip','r')
def trypassword(zipFile,password):
found = False
try :
zipFile.extractall(pwd=bytes(password,'ascii'))
found = True
except :
pass
return found
password='12345'
print(trypassword(infile,password))
extractall 是验证你的压缩文件和你代码的密码是否一致,如果你的压缩文件没有密码也会返回True,如果压缩文件和你代码密码不一样就会False