This code can be found in the tarfile, which accompanies this article, in the file display. c. 这些代码可以在本文附带的归档文件中找到,文件名是display.c。
This approach can be clumsy and isn't very "Pythonic." This example uses the tarfile module to open a tar file, which has the advantage of allowing you to use Python attributes and methods as you manipulate the file. 这种方法可能比较笨拙,并且不是非常符合Python的习惯。这个示例使用tarfile模块打开tar文件,这样做的好处是,在操作文件时允许您使用Python的属性和方法。