Using the 'with' statement with cStringIO objects

peppergrower spamcomefindmeplease at gmail.com
Sat Sep 27 18:28:49 EDT 2008


Thanks for the help.  I'm fairly new to programming (which you
probably could have guessed...).  When I realized that you could use a
StringIO instance as if it were a file, I wanted to try some of the
same techniques on it as I would with a file.  In this case, I wanted
to use a "for line in testfile" construction to iterate over the
StringIO instance.  (I did find a better way for my particular case,
one that didn't involve StringIO at all.)  When I got that particular
error, I suspected that it had something to do with the relative
newness of the 'with' statement.

If this is something that should be considered for addition in the
future, is there somewhere specific I should suggest that?



More information about the Python-list mailing list