tfile = tarfile.open(fileName, 'r|gz')
for t in tfile:
    if 'file3' in t.name:
        f = tfile.extractfile(t)
if f:
    pass
Tarfile in Python: Can I untar more efficiently by extracting only some of the data?