file and directory handling attribute description ti issym(ti linkname ti mode ti mtime ti name ti size ti type returns true if the object is symbolic link target filename of hard or symbolic link permission bits last modification time archive member name size in bytes file type that is one of the constants regtypearegtypelnktypesymtypedirtypefifotypeconttypechrtypeblktypeor gnutype_sparse user id username ti uid ti uname exceptions the following exceptions are defined by the tarfile moduletarerror base class for all other exceptions readerror raised when an error occurs while opening tar file (for examplewhen opening an invalid filecompressionerror raised when data can' be decompressed streamerror raised when an unsupported operation is performed on stream-like tarfile object (for instancean operation that requires random accessextracterror raised for nonfatal errors during extraction (only if errorlevel is set to example open tar file and put some files into it tarfile open("foo tar"," " add("readme"import glob for pyfile in glob glob("py") add(pyfilet close(open tar file and iterate over all of its members tarfile open("foo tar"for in tprint("% % ( namef size)scan tar file and print the contents of "readmefiles tarfile open("foo tar" lib fl ff