TarInfo
object. If member is a regular file or a link, an io.BufferedReader
object is returned. Otherwise, None
is returned.RawIOBase
object. It inherits BufferedIOBase
. When reading data from this object, a larger amount of data may be requested from the underlying raw stream, and kept in an internal buffer. The buffered data can then be returned directly on subsequent reads.BufferedReader
for the given readable raw stream and buffer_size. If buffer_size is omitted, DEFAULT_BUFFER_SIZE
is used.BufferedReader
provides or overrides these methods in addition to those from BufferedIOBase
and IOBase.
import tarfile
t = tarfile.open('tarfile_add.tar', 'r')
for filename in [ 'README.txt', 'notthere.txt' ]:
try:
f = t.extractfile(filename)
except KeyError:
print 'ERROR: Did not find %s in tar archive' % filename
else:
print filename, ':', f.read()
import tarfile
import os
os.mkdir('outdir')
t = tarfile.open('tarfile_add.tar', 'r')
t.extractall('outdir')
print (os.listdir('outdir'))
Name | Views | Likes |
---|---|---|
Python project_Speech to text | 478 | 3 |
Tarfile_Metadata | 378 | 6 |
Library_Tarfile | 631 | 5 |
python project_color detection | 538 | 3 |
Text to Speech using Python | 445 | 6 |
Tarfile_TarInfo Objects | 312 | 5 |
Tarfile_Extracting file from Archive | 264 | 3 |
Tarfile_generator function | 295 | 3 |
tarfile_targzstream | 259 | 7 |
Tarfile_Exception | 643 | 5 |
python Project_Detecting Fake news | 773 | 3 |
Tarfile_working with compressed archives | 328 | 5 |
Tarfile_Objects | 367 | 5 |
Project in python_color detection | 76 | 1 |
Tarfile_Archive Access | 342 | 5 |
Comments