Python tarfile module is used to read and write tar archives. Python provides us excellent tools and modules to manage compressed files, which includes (but not limited to) performing file and directory compression with different mechanisms like gzip, bz2 and lzma compression.
Python tarfile模块用于读取和写入tar归档文件。 Python为我们提供了出色的工具和模块来管理压缩文件,其中包括(但不限于)使用gzip,bz2和lzma压缩等不同机制执行文件和目录压缩。
In this post, we will see various practical demonstrations of Python tarfile module functions. This is similar to python zip function. Let’s get started.
在本文中,我们将看到Python tarfile模块功能的各种实际演示。 这类似于python zip函数。 让我们开始吧。
Python tarfile模块 (Python tarfile module)
Python tarfile module provides us functions to perform various operations like:
Python tarfile模块为我们提供了执行各种操作的功能,例如:
- read and write gzip, bz2 and lzma archives 读写gzip,bz2和lzma档案
- read and write POSIX.1-1988 (ustar) format 读写POSIX.1-1988(ustar)格式
- read and write support for GNU tar format 对GNU tar格式的读写支持