[Tutor] memory error
Alan Gauld
alan.gauld at btinternet.com
Tue Mar 10 12:46:43 CET 2009
"Harris, Sarah L" <sarah.l.harris at jpl.nasa.gov> wrote
fname=filter(isfile, glob.glob('*.zip'))
for fname in fname:
This will confuse things. fname starts off as a list of files
and then becomes a single filename inside the loop.
It's never a good idea to duplicate variable names
like that. It also means that after the loop completes
fname referes only to the last filename, the list has gone.
zipnames=filter(isfile, glob.glob('*.zip'))
for zipname in zipnames:
This is much better.
HTH,
Alan G.
More information about the Tutor
mailing list