[Tutor] Removing a file from a tar

Adam A. Zajac strider1551 at gmail.com
Wed Jun 27 17:26:17 CEST 2007


I was reading over the documentation for the tarfile module and it
occurred to me that there didn't seem to be a way to remove an
individual file from the tar.

For example, suppose I did this:

import tarfile
tar = tarfile.open("sample.tar", "w")
tar.add("unwanted")
tar.add("wanted")
tar.close()

At this point, how could I come back and remove "unwanted" from the tar?


More information about the Tutor mailing list