format(limit=None)
Format the traceback as a list of lines with newlines. Use the linecache module to retrieve lines from the source code. If limit is set, only format the limit most recent frames.
Similar to the traceback.format_tb() function, except that format() does not include newlines.
Example:
print("Traceback (most recent call first):")
for line in traceback:
print(line)
Output:
Traceback (most recent call first):
File "test.py", line 9
obj = Object()
File "test.py", lin