Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

try and except in python

# Try and Except in python are for taking care of errors
# which may occur at runtime.
# For example:

# If flask is not installed, you will get an ImportError saying flask
# is not installed.
# The try keyword is to try running that block of code which may cause an error.
try:
    from flask import Flask
except ImportError:
    print('Flask is not installed! Use pip install flask to install it.')
Source by softhunt.net #
 
PREVIOUS NEXT
Tagged: #python
ADD COMMENT
Topic
Name
5+2 =