Learning Python: Open file and convert them to upper case



fname = raw_input("Enter file name: ")
fh = open(fname)
for line in fh:
    print line.strip().upper()

Explanation

  1. Prompt to enter a file name
  2. set a file open handle as fh
  3. loop through entire handle
  4. print each line out with new line and all in upper case.