reading a text file

superpollo user at example.net
Wed Aug 19 04:40:28 EDT 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