On 9/9/07, David <[EMAIL PROTECTED]> wrote: > > tokenize.tokenize( > > file.readline, > > processStrings > > ) > > > > How would you go about writing the output to a file? I mean, I would > > like to open the file at main level and pass a handle to the file to > > processStrings to write to it, finally close output file at main level. > > Probably a class with a processString method? >
You can also use closures for this. http://ivan.truemesh.com/archives/000411.html See the example in the "Assignment considered awkward" section. Since you're not assigning to your file variable in processStrings you don't have to use the list work-around mentioned later in the doc. -- http://mail.python.org/mailman/listinfo/python-list