Spell-checking Python source code
wizzardx at gmail.com
Sun Sep 9 17:02:50 CEST 2007
> 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?
tokenize.tokenize() takes a callable object as it's second arg. So you
can use a class which you construct with the file, and you give it an
appropriate __call__ method.
Although with a short script a global var may be simpler.
More information about the Python-list