current position:Home>Use of extractall function of Python zipfile module

Use of extractall function of Python zipfile module

2022-02-03 00:39:00 CSDN Q & A

A six digit password is OK , But a five digit password is output False, Why is that ?

infile = zipfile.ZipFile('test.zip','r')def trypassword(zipFile,password):    found = False    try :        zipFile.extractall(pwd=bytes(password,'ascii'))        found = True    except :        pass     return foundpassword='12345'print(trypassword(infile,password))



Refer to the answer 1:

extractall Is to verify whether your compressed file is consistent with the password of your code , If your compressed file has no password, it will also return True, If the compressed file is different from your code password, it will False




Refer to the answer 2:

copyright notice
author[CSDN Q & A],Please bring the original link to reprint, thank you.
https://en.primo.wiki/2022/02/202202030038585501.html

Random recommended