### Description: Decompress a .tar.bz2 archive URL: http://sebsauvage.net/python/snyppets/index.html License: Unspecified/Public Domain ### import tarfile import bz2 archive = tarfile.open('myarchive.tar.bz2','r:bz2') archive.debug = 1 # Display the files beeing decompressed. for tarinfo in archive: archive.extract(tarinfo, r'd:\mydirectory') # d:\mydirectory is where I want to uncompress the files. archive.close()