Using zipfile.py

ColBoy colinmeeks at home.com
Wed Jun 28 14:02:52 EDT 2000


After much tinkering, I finally managed to get the syntax right.  Just
thought I'd
post my snippet here in case anyone is interested.

import zipfile
zzz=zipfile.ZipFile('c:\\download\\new\\x2000.zip', "r")
zzz.printdir()
print zzz.read('license.txt')

I imagine I can open a binary file in a zip file and write it out to disk
somewhere,
do I have to use the standard file operations to do this. It's taking me a
while to
get to grips with things, mainly because I haven't got any books on Python
yet,
although they are on order.  I've ordered Python Essentials and Python
Pocket
Reference, hopefully they will get me up to speed. My main experience is in
Clipper and Delphi.  I originally wanted to add Perl to my skill set, but I
just
haven't been able to get into it, in the same way I have with Python.

Colin


ColBoy <colinmeeks at home.com> wrote in message
news:3%d65.680$ZI2.26352 at news1.rdc1.on.wave.home.com...
> Could anybody give me a dummies guide to using the zipfile.py module.
Just
> a couple of examples of viewing a zips contents and extracting all of a
zips
> contents.  I know this is probably dead simple, but I'm still working my
way
> around Pythons syntax for stuff.  Many thanks in advance.
>
> Regards
>
> Colin
>
>





More information about the Python-list mailing list