Aug-09-2020, 05:27 AM
Hi,
I am trying to write code with exception arguments. Somehow it doesn't work.
What am i doing wrong? Any input is much appreciated!
I am trying to write code with exception arguments. Somehow it doesn't work.
What am i doing wrong? Any input is much appreciated!
import sys
try:
File = open('myfile.txt')
except IOError as e:
print("Bestand wordt niet geopend!\r\n" +
"Foutnummer: (0)\r\n".format(e.erno) +
"Fouttekst: (0)".format(e.strerror))
else:
print("Bestand probleemloos geopend.")
File.close();
