File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -810,7 +810,7 @@ A ``TarInfo`` object has the following public data attributes:
810810.. attribute :: TarInfo.size
811811 :type: int
812812
813- Size in bytes.
813+ Size of the archived file's data in bytes.
814814
815815
816816.. attribute :: TarInfo.mtime
@@ -1387,6 +1387,17 @@ a generator function instead of a list::
13871387 tar.extractall(members=py_files(tar))
13881388 tar.close()
13891389
1390+ How to read the content of a specific archive member into memory::
1391+
1392+ import tarfile
1393+
1394+ with tarfile.open("sample.tar.gz") as tar:
1395+ for member in tar:
1396+ f = tar.extractfile(member)
1397+ if f is not None:
1398+ content = f.read()
1399+ break
1400+
13901401How to read a gzip compressed tar archive and display some member information::
13911402
13921403 import tarfile
You can’t perform that action at this time.
0 commit comments