Problem with a tuple - newbie ignorance
Steven Citron-Pousty
steven.citron-pousty at yale.edu
Mon Jan 15 12:36:49 EST 2001
Greetings all:
So I am writing this program to parse text files. I am using a tuple to
store the field names and values (i.e. [['id =', 't =',
...]['','',...]]. The program reads through all the files in the
directory. For each file it writes all the all the matches in teh
appropriate field. I am having several problems, but the biggest right
now is:
When the program goes to parse the next file it doesn't clear out the
contents from the last file. Here is how I thought it should work...
<Header stuff>
ifields = [[fields names list][list of just '','','']
<FOR loop with all the file names from the directory>
open file
results = ifields
<fill the results tuple>
<print the results tuple>
<go back to the top of the loop>
For some reason I thought that each time results gets sets to ifields it
should reset the contents of results. I have tried all sorts of other
workarounds, such as using "del results" just before I go back and
repeat the loop.
What am I missing here?
Thanks for your help...
Steve
More information about the Python-list
mailing list