I have a tar.gz file, and I want to extract a certain directory but not the whole thing, so I use TarFile.getmember('foo/bar'). what I want to know is if I really should be using TarFile.getmember(os.path.join('foo','bar')).
edit: I'm also wondering if I would use os.path.join for any other function within the tarfile module or zipfile moduple.
No, the argument to getmember is the key inside the tar file, not a local file system path. Use the slashes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With