Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

7
  • 2
    w3schools.com/python/python_try_except.asp Commented Jul 13, 2020 at 17:34
  • 3
    What have you read on the topic and what is not clear about it? Commented Jul 13, 2020 at 17:35
  • 1
    Google ‘exception handling in python’. It is rather different to an if else. Note that the code in finally always runs, which can be useful. Commented Jul 13, 2020 at 17:36
  • The vendor seems to provide information on the subject: docs.python.org/3/tutorial/errors.html Commented Jul 13, 2020 at 17:37
  • 1
    Basically, they are there to catch errors. If you have some code that might result in an error, you put it in a try block and if it creates an error, the code in except gets executed instead of your program just stopping. Commented Jul 13, 2020 at 17:37