I\'m using the following code to extract a tar file:
import tarfile
tar = tarfile.open(\"sample.tar.gz\")
tar.extractall()
tar.close()
However,
You can just use tqdm() and print the progress of the number of files being extracted:
import tarfile
from tqdm import tqdm
# open your tar.gz file
with tarfile.open(name=path) as tar:
# Go over each member
for member in tqdm(iterable=tar.getmembers(), total=len(tar.getmembers())):
# Extract member
tar.extract(member=member)