[Tutor] memory error
Harris, Sarah L
sarah.l.harris at jpl.nasa.gov
Sat Mar 7 01:03:22 CET 2009
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090306/1fdba6ed/attachment.htm>
More information about the Tutor
mailing list