----------------------------pickle----------------------------
try: import cPickle as pickle
except: import pickle
dump/load
dumps/loads
a = dic/array/list
with open(file, 'wb') as f:
pickle.dump(a, f, -1)
with open(file) as f:
a = pickle.load(f)
--------------------------------glob-----------------
xx = glob.glob('xxx') [] * . return list
yy = glob.iglob('xxx') return generator
--------------------------tarfile------------------
import tarfile
tar = tarfile.open(file.tar)
tar.extractall()
tar.close()
with tarfile.open(file) as tar:
tar.extractall()
tar = tarfile.opem(file.tar, 'w')
tar.add(file)
-------------------------------refrence-------------------------------
https://docs.python.org/3/library/tarfile.html