0

The user types the name of file. If he writes the wrong name of the file and python has an error like "FileNotFoundError: [Errno 2] No such file or directory: '5'". How can I write to user that he has typed the wrong name of the file? This code doesn't want to work:

try: 
    filename = input ("Your file name")
except OSError as e:
    print('We have an error: ', str(e))
Aran-Fey
  • 39,665
  • 11
  • 104
  • 149
Darentina
  • 13
  • 3

0 Answers0