Powered by Ajaxy
Digg StumbleUpon LinkedIn YouTube Flickr Facebook Twitter RSS Reset

Python: How tocatch several exceptions

Python: How tocatch several exceptions

def division(x, y):
      except ZeroDivisionError:
          print "Cannot divide",x,"by zeo"  
      except TypeError, e:
          print e  # Type exception
print division(4,2)
print division(1,0)
print division("1",2)#unsupported operand type(s) for /: 'str' and 'int'

Users who found this page were searching for:

  • format date using java calendar
  • create a python program class
  • python time.asctime() format
  • how to send a mail from java file

No comments yet.

Leave a Comment