file and directory handling if the parameter fileobj is specifiedit must be an open file object in this casethe file overrides any filename specified with name bufsize specifies the block size used in tar file the default is * bytes tarfile instancetreturned by open(supports the following methods and attributest add(name [arcname [recursive]]adds new file to the tar archive name is the name of any kind of file (directorysymbolic linkand so onarcname specifies an alternative name to use for the file inside the archive recursive is boolean flag that indicates whether or not to recursively add the contents of directories by defaultit is set to true addfile(tarinfo [fileobj]adds new object to the tar archive tarinfo is tarinfo structure that contains information about the archive member fileobj is an open file object from which data will be read and saved in the archive the amount of data to read is determined by the size attribute of tarinfo close(closes the tar archivewriting two zero blocks to the end if the archive was opened for writing debug controls the amount of debugging information producedwith producing no output and producing all debugging messages messages are written to sys stderr dereference if this attribute is set to truesymbolic and hard links are dereferenced and the entire contents of the referenced file are added to the archive if it' set to falsejust the link is added errorlevel determines how errors are handled when an archive member is being extracted if this attribute is set to errors are ignored if it' set to errors result in oserror or ioerror exceptions if it' set to nonfatal errors additionally result in tarerror exceptions extract(member [path]extracts member from the archivesaving it to the current directory member is either an archive member name or tarinfo instance path is used to specify different destination directory extractfile(memberextracts member from the archivereturning read-only file-like object that can be used to read its contents using read()readline()readlines()seek()and tell(operations member is either an archive member name or tarinfo object if member refers to linkan attempt will be made to open the target of the link getmember(namelooks up archive member name and returns tarinfo object containing information about it raises keyerror if no such archive member exists if member name appears lib fl ff