A
A
AlexCruel2020-08-04 10:22:34
Python
AlexCruel, 2020-08-04 10:22:34

Missing an error?

Is there a way to handle any errors so that it is found but the script doesn't stop? Say 'pass' is used. Can I have an example?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Pikeev, 2020-08-04
@AlexCruel

try:
    # Код, который может привести к ошибке
except ErrorType: # Тип ошибки(KeyError, ValueError и т.п.
    # Код, который выполнится после ошибки
# Тоже код который выполнится после

D
Dr. Bacon, 2020-08-04
@bacon

https://docs.python.org/3/tutorial/errors.html#han...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question