Python 3.4 - Exception Handling

Sometimes you may have code that could send an error message. This could happen for many reasons. Including a try block of code can handle these situations.

try:
    f = open('main2.py')
except Exception:
    print('sorry')

It is better if you know what kind of error yo can expect to customize the error message or redirect. 

try:
    print("hello")
except Exception:
    print("hellowwww")
else:
    print("me too me too")
finally:
    print("WHo cares!")

https://www.youtube.com/watch?v=NIWwJbo-9_8

Comments

Popular posts from this blog

Pyhton 3.4 - Continue

Conversations Ongoing: Valuing Modernization in Early European History

Conversations Ongoing: A Bunch of Amateurs