How to separate operations by error when using python try, except

Asked 2 years ago, Updated 2 years ago, 21 views

How do I write except to separate the processing for each error?
If there is a collection of the entire error, you can write the action after except:
I would like to know how to do something different only for certain errors.

python

2022-09-30 19:46

1 Answers

You should identify and describe the error after the error as follows:

try:
    # Some code
except Error 1:
    # Action 1
except Error 2:
    # Action 2


2022-09-30 19:46

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.