Zip file
|
import zipfile def data_to_zip_direct(z, data, name): import time zinfo = zipfile.ZipInfo(name, time.localtime()[:6]) z.writestr(zinfo, data) def data_to_zip_indirect(z, data, name): import os flob = open(name, 'wb') flob.write(data) flob.close() z.write(name) os.unlink(name) zz = zipfile.ZipFile('z.zip', 'w', zipfile.ZIP_DEFLATED) data = 'four scorenand sevennyears agon' data_to_zip_direct(zz, data, 'direct.txt') data_to_zip_indirect(zz, data, 'indirect.txt') zz.close()
|
|
|
|
|
Related Scripts with Example Source Code in same category :
-
-
-
|
|