Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python try

try:
    # Floor division
    x = 10
    y = 0
    result = x // y
except ZeroDivisionError:
    print("You are dividing by zero!")
except:
    # Exception other than ZeroDivisionError
    print("Oh! got unknown error!")
else:
    # Execute if no exception
    print("The answer is: {}".format(result))
finally:
    # Always execute
    print('This is always executed')
Source by www.codegrepper.com #
 
PREVIOUS NEXT
Tagged: #python
ADD COMMENT
Topic
Name
5+2 =