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 :) -- http://mail.python.org/mailman/listinfo/python-list