Select in Python
Dio
dio.lee at gmail.com
Tue Jun 27 02:49:30 EDT 2006
K.S.Sreeram 写道:
> Dio wrote:
> > while 1:
> > (rr, wr, er) = select([stdin], [], [])
> > for fd in rr:
> > print fd
> >
> > program block in the first select(), after I type something and "enter
> > ", it never block in select() again,why?
>
> select blocks until there is some data to read from stdin, but it does
> not *clear* the data. so once you enter data, select will not block
> until you read the data. once you're done reading the available data,
> you can again use select to block until more data is available.
>
> Regards
> Sreeram
Thanks a lot!I use stdin.readline() after select and it's ok :)
More information about the Python-list
mailing list