In this, we are going to see an example of Else and Finally Statement that is done using Exception Handling in Python Programming Language.
try:
f = open("test.txt","w")
except IOError:
print("Something went wrong when opening the file")
else:
f.write("Hello World")
print("Written in file")
finally:
f.close()
# Coded by Saahil
#ENJOY CODING
Post a Comment
FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP