surab
surab

Reputation: 11

create a lzma file in python

i need to create a lzma file with the existing .tar file and another metadata file to further create a zip file.

Upvotes: 1

Views: 1757

Answers (2)

Pete
Pete

Reputation: 343

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

Upvotes: -1

Joschua
Joschua

Reputation: 6034

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!

Upvotes: 1

Related Questions