Answer the question
In order to leave comments, you need to log in
How to jump to a specific line of code in python?
Hello, is it possible to do this in python: when I catch an exception, I do some action (for example driver.refresh()
) and run the code again from the line in which the exception occurred
Answer the question
In order to leave comments, you need to log in
The meaning is this:
while True: # вечный цикл
try:
# действия
break # выход из цикла, если действия прошли успешно
except Exception:
pass # В случае ошибки ничего не делать.
# Или вместо pass написать continue, чтобы было очевидно,
# что надо сразу перейти к следующей итерации.
You can do it, but are you sure that try / except is needed here? Maybe check the conditions for the correctness of the work?
If you could post the code, it would be possible to tell.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question