Created
October 11, 2011 22:02
-
-
Save ileacristian/1279592 to your computer and use it in GitHub Desktop.
python snippet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def foo(): | |
# corpul functiei | |
raise ValueError("Acesta este mesajul exceptiei") | |
try: | |
# bloc pentru codul "suspect" | |
foo() | |
except ValueError as exception: | |
# cod pentru tratarea exceptiei | |
print(exception.args[0]) # afisam primul argument al exceptiei |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment