reading a text file

superpollo user at example.net
Wed Aug 19 10:40:28 CEST 2009


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())
     except StopIteration:
         break

???




More information about the Python-list mailing list