Re: reading a text file

2009-08-19 Thread Tino Wildenhain
superpollo wrote: hi clp what's the difference between: while True: input_line = sys.stdin.readline() if input_line: sys.stdout.write(input_line.upper()) else: break and: while True: try: sys.stdout.write(sys.stdin.next().upper()) e

Re: reading a text file

2009-08-19 Thread Peter Otten
superpollo wrote: > hi clp > > what's the difference between: > > while True: > input_line = sys.stdin.readline() > if input_line: > sys.stdout.write(input_line.upper()) > else: > break > > and: > > > while True: > try: > sys.stdo

Re: reading a text file

2009-08-19 Thread Paul Rubin
superpollo writes: > while True: > try: > sys.stdout.write(sys.stdin.next().upper()) > except StopIteration: > break Maybe there is some subtle difference, but it looks like you really mean for line in sys.stdin: sys.stdout.write(line.upper()) -- http://mai