Skip to content

Instantly share code, notes, and snippets.

@rehatpsingh
Created October 28, 2020 09:14
Show Gist options
  • Select an option

  • Save rehatpsingh/6d016cc328f3fd183dfe59d28c6a1973 to your computer and use it in GitHub Desktop.

Select an option

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.
#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())
@AlQataberi

Copy link
Copy Markdown

have you solve it

Have you solve it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment