CLEAR INPUT BUFFER

Istvan Albert ialbert at mailblocks.com
Thu Oct 28 17:44:14 CEST 2004


Sam wrote:

> I tried to clear the buffer using sys.stdin.flush() but
> it seem not work.

In general you can't flush the standard input,
it is one of those undefined behaviors in C.

To read the input until an end-of-file is reached
use read() instead of readline().

Istvan.




More information about the Python-list mailing list