# File: zipfile-example-4.py

import zipfile
import glob, os, time

file = zipfile.ZipFile("test.zip", "w")

now = time.localtime(time.time())[:6]

for name in ("life", "of", "brian"):
    info = zipfile.ZipInfo(name)
    info.date_time = now
    info.compress_type = zipfile.ZIP_DEFLATED
    file.writestr(info, name*1000)

file.close()

# open the file again, to see what's in it

file = zipfile.ZipFile("test.zip", "r")

for info in file.infolist():
    print info.filename, info.date_time, info.file_size, info.compress_size

## $ python zipfile-example-4.py
## life (2000, 12, 1, 0, 12, 1) 4000 26
## of (2000, 12, 1, 0, 12, 1) 2000 18
## brian (2000, 12, 1, 0, 12, 1) 5000 31
