[Tutor] How to read content in a tar file with tarfile module
Hugo González Monteverde
hugonz-lists at h-lab.net
Tue Oct 10 21:19:20 CEST 2006
Magnus Wirström wrote:
> I have written a app that makes a tar file and all works well... Now i
> want to expand that app so it can read read the tar and give me the
> contents of the tar file. How is the best way to do this ? I can't find
> a "listdir" like function in tarfile. Can anyone point me in the right
> direction?
Hi, is this what you're looking for?? (tarfile Object docs)
getmembers( )
Return the members of the archive as a list of TarInfo objects. The list
has the same order as the members in the archive.
getnames( )
Return the members as a list of their names. It has the same order as
the list returned by getmembers().
Hugo
More information about the Tutor
mailing list