-
-
Save rehatpsingh/6d016cc328f3fd183dfe59d28c6a1973 to your computer and use it in GitHub Desktop.
7.1 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 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
#100% working solution for python backgroud or python 3 | |
fname = input("Enter file name: ") | |
try: | |
fh = open(fname) | |
except: | |
print('file not found:error') | |
quit() | |
text=fh.read() | |
res=text.upper() | |
print(res.rstrip()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Have you solve it