How To Decompress A .xz File Which Has Multiple Folders/files Inside, In A Single Go?
I'm trying to uncompress a .xz file which has a few foders and files inside. I don't see a direct way to do this using lzma module. This is what I'm seeing for a decompress method
Solution 1:
Python 3.3
import tarfile
with tarfile.open('test.tar.xz') as f:
f.extractall('.')
Python 2.7
Need lzma in Python 2.7
import contextlib
import lzma
import tarfile
with contextlib.closing(lzma.LZMAFile('test.tar.xz')) as xz:
with tarfile.open(fileobj=xz) as f:
f.extractall('.')
Post a Comment for "How To Decompress A .xz File Which Has Multiple Folders/files Inside, In A Single Go?"