-8

Does anyone know how to open a password protected zip file with python if the password is "123" and the file name is :

/tmp/alien-zip-2092.zip

And then also read the txt file inside it?

1 Answers1

-1

Here is one way to do it:

import zipfile

zip = zipfile.ZipFile('/tmp/alien-zip-2092.zip', 'r')
zip.setpassword(b"123")
zip.extractall('extract/folder')
zip.close()
nowox
  • 22,446
  • 24
  • 118
  • 241