Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
4
Task/Exceptions/Python/exceptions-1.py
Normal file
4
Task/Exceptions/Python/exceptions-1.py
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
import exceptions
|
||||
class SillyError(exceptions.Exception):
|
||||
def __init__(self,args=None):
|
||||
self.args=args
|
||||
2
Task/Exceptions/Python/exceptions-2.py
Normal file
2
Task/Exceptions/Python/exceptions-2.py
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
class MyInvalidArgument(ValueError):
|
||||
pass
|
||||
2
Task/Exceptions/Python/exceptions-3.py
Normal file
2
Task/Exceptions/Python/exceptions-3.py
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
def spam():
|
||||
raise SillyError # equivalent to raise SillyError()
|
||||
2
Task/Exceptions/Python/exceptions-4.py
Normal file
2
Task/Exceptions/Python/exceptions-4.py
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
def spam():
|
||||
raise SillyError, 'egg' # equivalent to raise SillyError('egg')
|
||||
2
Task/Exceptions/Python/exceptions-5.py
Normal file
2
Task/Exceptions/Python/exceptions-5.py
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
def spam():
|
||||
raise SillyError('egg')
|
||||
10
Task/Exceptions/Python/exceptions-6.py
Normal file
10
Task/Exceptions/Python/exceptions-6.py
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
try:
|
||||
foo()
|
||||
except SillyError, se:
|
||||
print se.args
|
||||
bar()
|
||||
else:
|
||||
# no exception occurred
|
||||
quux()
|
||||
finally:
|
||||
baz()
|
||||
10
Task/Exceptions/Python/exceptions-7.py
Normal file
10
Task/Exceptions/Python/exceptions-7.py
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
try:
|
||||
foo()
|
||||
except SillyError as se:
|
||||
print(se.args)
|
||||
bar()
|
||||
else:
|
||||
# no exception occurred
|
||||
quux()
|
||||
finally:
|
||||
baz()
|
||||
Loading…
Add table
Add a link
Reference in a new issue