Answers for "how to get line number while handling exception in python"

2

exception get line number python

import traceback

try:
    print(4/0)
except ZeroDivisionError:
    print(traceback.format_exc())
Posted by: Guest on January-28-2021

Code answers related to "how to get line number while handling exception in python"

Python Answers by Framework

Browse Popular Code Answers by Language