Revision: 26573
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at May 1, 2010 12:28 by throb
Initial Code
import zlib, zipfile, os def zipme (inputFilename): fileName = os.path.basename(inputFilename) zipFileName = os.path.basename (os.path.splitext(fileName)[0]) + '.zip' zipFilePath = os.path.dirname (inputFilename) zFile = zipfile.ZipFile(zipFilePath + '/' + zipFileName ,'w') zFile.write (inputFilename, fileName, zipfile.ZIP_DEFLATED) zFile.close() if os.stat(zipFileName): print 'zipfile created : %s' % (zipFileName) return 1 else : print 'Error creating zipfile : %s' % (zipFileName) return 0
Initial URL
Initial Description
This creates a zipfile with the same name as the input file in the same location as the input file. Only does a single file.
Initial Title
create a zipfile from an input file
Initial Tags
python
Initial Language
Python