开发者

create a lzma file in python

开发者 https://www.devze.com 2023-01-06 11:22 出处:网络
i need to create a lzma file with the existing .tar file and another metadata 开发者_如何学运维file to further create a zip file.first download/install PyLZMA. In your program, use it as described her

i need to create a lzma file with the existing .tar file and another metadata 开发者_如何学运维file to further create a zip file.


first download/install PyLZMA. In your program, use it as described here. And to create a zip, you can use the zipFile-module of the standard-library, which works as follows:

# open the zip file for writing, and write stuff to it

file = zipfile.ZipFile("test.zip", "w")

for name in a_demo_list_of_files:
    file.write(name, os.path.basename(name), zipfile.ZIP_DEFLATED)

file.close()

Hope it helps!


if you can use python 3.3 and later, you could use the built-in lzma module

0

精彩评论

暂无评论...
验证码 换一张
取 消