Skip to content

Instantly share code, notes, and snippets.

@hareom284
Created July 22, 2020 14:57
Show Gist options
  • Save hareom284/a9c977e67a43d4002cb3f1e873e66563 to your computer and use it in GitHub Desktop.
Save hareom284/a9c977e67a43d4002cb3f1e873e66563 to your computer and use it in GitHub Desktop.
Write a program that prompts for a file name, then opens that file and reads through the file, and print the contents of the file in upper case. Use the file words.txt to produce the output below.
fname = input("Enter file name: ")
try :
fh = open(fname)
except:
print(fname," files does not exit .Enter valid file names")
quit()
for line in fh :
line =line.rstrip()# for removing newline from the letter
print(line.upper())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment