Hello,
I am very much a beginner at programming. As a learning tool I am trying to 
extract multiple zipped files. I got it to work after looking at lots of other 
examples (see below for code) but because some of my files are quite large I 
end up with a 'Memory Error'. Is there a simple way to fix this?

import zipfile, glob, os
os.chdir('E:\\test1')
from os.path import isfile
fname=filter(isfile, glob.glob('*.zip'))
for fname in fname:
    zipnames=filter(isfile, glob.glob('*.zip'))
    for zipname in zipnames:
        zf=zipfile.ZipFile(zipname, 'r')
        for zfilename in zf.namelist():
            newFile=open(zfilename, 'wb')
            newFile.write(zf.read(zfilename))
            newFile.close()
    zf.close()
print 'done'
Regards
Sarah
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to