[PYTHON] Exception handling

ex.py


l = [2,4,5,8]

try:
    l[5]
except NameError as ex:
    print('Error message:', ex)
except Exception as ex: #Catch other exceptions (although this usage is not recommended)
    print('Error message:',ex)
else:
    print('Only executed if successful')
finally:
    print('Will always be executed')

Recommended Posts

Exception handling
Python exception handling
boto3 exception handling
Python exception handling
Python, about exception handling
Fizzbuzz with exception handling
Python exception handling (Python learning memo ⑥)
Exception handling using Python's ZeroDivisionError
Exception handling during Python API communication
I tried to summarize Python exception handling
[Introduction to Udemy Python3 + Application] 65. Exception handling
[Introduction to cx_Oracle] (12th) DB Exception Handling
Pharmaceutical company researchers summarized Python exception handling
Python exception handling a little more convenient
Module import and exception handling in python
Mainframe error handling
Python Error Handling
Multi-condition data handling
Python timezone handling
Proprietary exception class
High Memory Handling
django.db.migrations.exceptions.InconsistentMigrationHistory error handling
[Python for Hikari-] Chapter 07-01 Exception Handling (Errors and Exceptions)