why can't python unzip a password protected zip file created by winrar using the zip method?

前端 未结 2 929
囚心锁ツ
囚心锁ツ 2020-12-01 17:14

I have searched the web high and low but still couldn\'t find a solution for the above problem. Does anyone out there know why and if so how it can be done?

         


        
2条回答
  •  半阙折子戏
    2020-12-01 18:02

    To offer the exact syntaxt without acronym:

    from zipfile import ZipFile
    
    str_zipFile = 'FileZip.zip'
    str_pwd= 'xxxx'
    
    with ZipFile(str_zipFile) as zipObj:
      zipObj.extractall(pwd = bytes(str_pwd,'utf-8'))
    

提交回复
热议问题