Sunday, September 20, 2009

Python - create and add files to a zip archive

# you may also be interested in reading 
# zip files ... check out my reading zip files post 

import zipfile 

t = ""

# create a new zip file
# use the 'w' to write a new file
zippy = zipfile.ZipFile(t, "w")

# add contents to zip file
# I used a couple files I had sitting around
# you'll need to change these to files in your
# current directory
print 'Adding contents to zip file...'

print 'zip file creatd.'
# the zip file is ready to use

No comments:

Post a Comment