[Tutor] try and except
Grigor Kolev
grigor.kolev at gmail.com
Tue Dec 29 21:47:38 CET 2009
Hi.
Can someone explain me where is my mistake.
-----------------------------------------------
class Error(Exception):
def printer(self , value ):
self.value = value
print self.value
def oops():
raise Error
def domoed():
try:
oops()
except Error:
Test = Error()
print 'Error: ', Test.printer('Test')
else:
print 'no error'
if __name__ == "__main__":
domoed()
------------------------------------------------------
Result is:
Error: Test
None
>From where come it None
--
Grigor Kolev <grigor.kolev at gmail.com>
More information about the Tutor
mailing list