Created
July 22, 2020 14:57
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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