# Program to print file contents # # Matt Bishop, MHI 289I, Fall 2021 # def main(): # get file name try: fname = input("Please enter the name of the file to print: ") except EOFError: return except: print("Could not read what you typed") return # # print file contents # # open the file try: infile = open(fname, 'r') except IOError: print("Error opening file", fname, "for reading") return except: print("Unknown error") return # read and print the contents content = infile.read() print(content) # clean up infile.close() main()