+ 1

How do you handle all possible exceptions in python

1st May 2019, 11:53 AM
Godeon Ong
Godeon Ong - avatar
2 odpowiedzi
+ 5
Bro u can use the except statement without the exception specified to handle all possible exception An except statement without any exception specified will catch all errors. These should be used sparingly, as they can catch unexpected errors and hide programming mistakes. Syntax: try: print(1/0) except: print("Except") Hence this will catch all possible errors Thanks
1st May 2019, 12:06 PM
Prince PS[Not_Active]
Prince PS[Not_Active] - avatar
+ 2
From the documentation: 8.3. Handling Exceptions https://docs.python.org/3/tutorial/errors.html It might be more beneficial to ask a more specific question in the future. You may find it helpful to review the following: https://www.sololearn.com/Blog/38/8-simple-rules-to-get-help-from-the-community Be sure not to miss the link to the Community Guidelines toward the bottom of the article. Happy coding!
8th May 2019, 6:41 AM
Janning⭐
Janning⭐ - avatar