Feb-14-2020, 01:00 AM
Hello, I need a way to capture an error message in a variable. For example:
-707
>>> print('2'+2) Traceback (most recent call last): File "<pyshell#0>", line 1, in <module> print('2'+2) TypeError: must be str, not intI 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