If there's a Python error, how do I start from the beginning?

Asked 2 years ago, Updated 2 years ago, 15 views

For example, If there's an error, we're going to start over from the beginning. Which one should I use, try exception or something?

python

2022-09-22 12:16

1 Answers

Trust your gut!

def just_get_it_done() :
    try:
        result = do_something()
        return result
    except Exception as swear:
        print(str(swear))
        just_get_it_done()

just_get_it_done()


2022-09-22 12:16

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.