unzip tar file

Normal zip or tar file can be extracted:

import os

import tarfile

tar = tarfile.open('./abc.tar.gz', "r:gz")

tar.extractall('c:/temp/extract/')

tar.close()

Sometimes the zip file may be using deflate64 protocol, then the above wont work. It has to use a different library:

import zipfile_deflate64 as zipfile

zf = zipfile.ZipFile()./abc.tar.gz' 

zf.extractall('c:/temp/extract/')