Skip to content

Instantly share code, notes, and snippets.

@timtan
Created March 26, 2013 11:40
Show Gist options
  • Save timtan/5244778 to your computer and use it in GitHub Desktop.
Save timtan/5244778 to your computer and use it in GitHub Desktop.
handle two type of error
__author__ = 'tim'
def a_lot_exception(a,b):
try:
x = 3/a
y = int(b,8)
return x + y
except ZeroDivisionError:
return 0
except ValueError:
return x
if __name__ == '__main__':
print a_lot_exception(1,'9')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment