Tarfile in Python: Can I untar more efficiently by extracting only some of the data?
问题 I am ordering a huge pile landsat scenes from the USGS, which come as tar.gz archives. I am writing a simple python script to unpack them. Each archive contains 15 tiff images from 60-120 mb in size, totalling just over 2 gb. I can easily extract an entire archive with the following code: import tarfile fileName = "LT50250232011160-SC20140922132408.tar.gz" tfile = tarfile.open(fileName, 'r:gz') tfile.extractall("newfolder/") I only actually need 6 of those 15 tiffs, identified as "bands" in