编辑器
import tarfile import io buffer = io.BytesIO() with tarfile.open(fileobj=buffer, mode='w') as tar: print('Tar archive created in memory') print(f'Format: {tar.format}')
Tar archive created in memory
Format: 2