micropython-lib/utarfile/example-extract.py

14 wiersze
263 B
Python
Czysty Zwykły widok Historia

2015-02-02 18:20:23 +00:00
import sys
import os
import shutil
import utarfile
t = utarfile.TarFile(sys.argv[1])
for i in t:
print(i)
if i.type == utarfile.DIRTYPE:
os.makedirs(i.name)
else:
f = t.extractfile(i)
shutil.copyfileobj(f, open(i.name, "wb"))