Boiler Plate Python

From Hive76 Wiki
Revision as of 23:00, 8 September 2009 by FarMcKon (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Boilerplace Python is a project of FarMcKon involving a few Hive76 members. The goal is to put out a small python tool in 20-50 lines each week. You can get to most of the examples at Far's Website

Zipping and Unzipping files

Zipping data into a file:

import zipfile
zipHandle = zipfile.ZipFile('','w',zipfile.ZIP_DEFLATED
del zipHandle

Listing what's in a file:

import zipfile
zipHandle = zipfile.ZipFile('','r')
filesInZip =  zipHandle.namelist():
for filename in filesInZip:
    print filename
del zipHandle