Adding Files to a ZIP File : Zip file : File PYTHON TUTORIALS


PYTHON TUTORIALS » File » Zip file »

 

Adding Files to a ZIP File


import os
import zipfile

tFile = zipfile.ZipFile("files.zip"'w')

files = os.listdir(".")
for f in files:
    tFile.write(f)

#List archived files
for f in tFile.namelist():
    print "Added %s" % f


tFile.close()



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON TUTORIALS

 Navioo File
» Zip file