tarInfo = tarFile.next() while tarInfo is not None: print(tarInfo.name) tarFile.extract(tarInfo, path = '/otherPath') tarInfo = tarFile.next() tarInfo.close()