Feb-14-2020, 01:00 AM
Hello, I need a way to capture an error message in a variable. For example:
I want to be able to capture this Traceback error message in a variable, maybe using a try: except: block. So what I want to know is: is there a way to get this error in a variable?
-707
1 2 3 4 5 |
>>> print ( '2' + 2 ) Traceback (most recent call last): File "<pyshell#0>" , line 1 , in <module> print ( '2' + 2 ) TypeError: must be str , not int |
-707