I'm trying to work with exception handling by displaying "No Such File" when the file doesn't exist. I need to use a try
statement.
import sys
try:
f = open("h:\\nosuchdirectory\\nosuchfile.txt","w") # do not modify this line
f.write("This is the grape file") # do not modify this line
f.close() # do not modify this line
except IOError:
print ("No Such File")
Started with:
f = open("h:\\nosuchdirectory\\nosuchfile.txt","w") # do not modify this line
f.write("This is the grape file") # do not modify this line
f.close() # do not modify this line