# Use words.txt as the file name fname = input("Enter file name: ") fh = open(fname) ah = fh.read().rstrip().upper() print(ah)