@vinaymavi
Exception Handling
Exception
try: <code> except <exception_class>: finally: <code>
try: raise Exception("This is custom exception") except Exception as e: print e finally: print "Finally calling"
User defined exception
class MyError(Exception): def __init__(self,msg, *args, **kwargs): self.message = msg def __str__(self): return self.message
H.W
try: foo = open("foo.txt") except IOError: print("error") else: print(foo.read()) finally: print("finished")
By Vinay Mavi
Exception handling
A fullstack developer curious to explore every thing in web development domain.