[EMAIL PROTECTED] wrote:
suppose I am reading lines from a file or stdin.
I want to just "peek" in to the next line, and if it starts
with a special character I want to break out of a for loop,
other wise I want to do readline().
[snip example]

Neither your description above nor your example actually
requires looking ahead.  Are you sure you need to?

You would only need it if *after* breaking out of the
loop, you wanted to continue reading from the file
*and* wanted the line which triggered the loop termination
still to be available for reading.

-Peter
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to