Maybe I've found a poorman's one: import sys while True: try: line = sys.stdin.readline() except: sys.stdin.seek(0) else: process(line)
Antal Rutz wrote: > Hi! > > Maybe a very newbie question but: > I'd like to write a prog which reads one line at a time on its sys.stdin > and immediately processes it. > If there are'nt any new lines wait (block on input). > > I couldn't find a solution for it. > Several methods that doesn't fit here: > - reading the entire file-like object until EOF and then process > - read one line(all lines) and when there aren't any lines more, quit. > > So I need a 'tail -f' for stdin. > > Thanks. > -- http://mail.python.org/mailman/listinfo/python-list