开发者

All files of a dir in tar as file-like obj

开发者 https://www.devze.com 2023-01-26 07:17 出处:网络
there is a simple way to get all files inside a spe开发者_Python百科cifically dir (dir that is in a tar file) one after another as a same file-like object?

there is a simple way to get all files inside a spe开发者_Python百科cifically dir (dir that is in a tar file) one after another as a same file-like object?

TNX


Use TarFile.getmembers() to get all the entries in a tarball, and iterate through them to filter the ones you want. Pass each in turn to TarFile.extractfile() to get a file-like to the entry within the tarball.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号