Python Exception

Try..Except #

try:
# codes
except:
# codes run if there is an exception
try:
# codes
except:
# codes run if there is an exception
else:
# no exception?
try:
# try codes
except FileNotFoundError as fnf_error:
print(fnf_error)
except AssertionError as error:
print(error)

Other Errors, check this list.

Apply #

Check str of float #

element = 'mean'
try:
print(float(element))
except ValueError:
if element == 'mean':
print('hello mean')

This is a draft note.