Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- >>> def doStuff():
- ... try:
- ... print "I'm doing stuff"
- ... a = [0]
- ... print a[1]
- ... except:
- ... print "Something has gone wrong"
- ...
- >>> doStuff()
- I'm doing stuff
- Something has gone wrong
- >>> def doStuff():
- ... print "I'm doing stuff"
- ... a = [0]
- ... print a[1]
- ...
- >>> doStuff()
- I'm doing stuff
- Traceback (most recent call last):
- File "<stdin>", line 1, in <module>
- File "<stdin>", line 4, in doStuff
- IndexError: list index out of range
- >>> def doStuff():
- ... try:
- ... print "I'm doing stuff"
- ... raise Exception
- ... except:
- ... print "Something has gone wrong"
- ...
- >>> doStuff()
- I'm doing stuff
- Something has gone wrong
- >>> def doStuff():
- ... print "I'm doing stuff"
- ... raise Exception
- ...
- >>> doStuff()
- I'm doing stuff
- Traceback (most recent call last):
- File "<stdin>", line 1, in <module>
- File "<stdin>", line 3, in doStuff
- Exception
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement