tracemalloc.Traceback.format()

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", line 12
    tb = tracemalloc.get_object_traceback(f())
doc_python
2016-10-07 17:45:20
Comments
Leave a Comment

Please login to continue.