Create an encrypted ZIP file in Python

后端 未结 5 783
一向
一向 2020-11-28 07:02

I am creating an ZIP file with ZipFile in Python 2.5, it works ok so far:

import zipfile, os

locfile = \"test.txt\"
loczip = os.path.splitext (locfile)[0] +         


        
5条回答
  •  离开以前
    2020-11-28 07:34

    I created a simple library to create a password encrypted zip file in python. - here

    import pyminizip
    
    compression_level = 5 # 1-9
    pyminizip.compress("src.txt", "dst.zip", "password", compression_level)
    

    The library requires zlib.

    I have checked that the file can be extracted in WINDOWS/MAC.

提交回复
热议问题