Kenil Vasani 646 Questions 567 Answers 77 Best Answers 26 Points View Profile 4 Kenil Vasani Asked: December 11, 20202020-12-11T20:34:11+00:00 2020-12-11T20:34:11+00:00In: Python python 3 try-except all with error 4 1 Answer Voted Rohit Patel 0 Questions 98 Answers 0 Best Answers 0 Points View Profile Best Answer Rohit Patel 2020-12-11T20:34:06+00:00Added an answer on December 11, 2020 at 8:34 pm Yes you can catch all errors like so: try: print(555) except Exception as e: print("type error: " + str(e)) For the stack trace I usually use the traceback module: import traceback try: print(555) except Exception as e: print("type error: " + str(e)) print(traceback.format_exc()) 5 Share Share Share on Facebook Share on Twitter Share on LinkedIn Share on WhatsApp You must login to add an answer. Username or email* Password* Remember Me! Forgot Password? Explore Most Answered Most Visited Most Voted Random
Rohit Patel
Yes you can catch all errors like so:
For the stack trace I usually use the traceback module: