'Extract a txz file inside a zipfile in Python

I have a zipfile which has the .txz file. Something like this:

 file1.zip
         |
          -- file2.txz
         |
          -- abc.txt

I have used ZipFile to extract the contents of file1.zip as below:

with zipfile.ZipFile(mainFile) as zf:
     for files in zf.namelist():
         zf.extract(files, dst)

But with this file2.txz is empty having 0 bytes although abc.txt is extracted properly.
How do I properly extract this txz file?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source