1 2 3 4 5 6 7 8 9 10 11 12 13 14
| [plxpy:~] python
Python 2.7.8 (v2.7.8:ee879c0ffa11, Jun 29 2014, 21:07:35)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import tarfile
>>> artar = tarfile.TarFile("archive.tar")
>>> artar.getnames()
['daily_2015-02-03_06:00:09.890457891']
>>>
>>> f = artar.extractfile('daily_2015-02-03_06:00:09.890457891')
>>> f
<tarfile.ExFileObject object at 0x106b71f10>
>>> open('toto', 'w').write(f.read())
>>> |