Hi Team,
I am using below code getting error message.
But I want error properly line by line. I wan to print that error properly line by line.
I am using below code getting error message.
But I want error properly line by line. I wan to print that error properly line by line.
import traceback
try:
print(4/0)
except ZeroDivisionError:
print(traceback.format_exc())Error:D:\Python\venv\Scripts\python.exe D:\Python\m12.py
Traceback (most recent call last):
File "D:\Python\m12.py", line 4, in <module>
print(4/0)
ZeroDivisionError: division by zeroExpected output:Output:File "D:\Python\m12.py"
line 4
print(4/0)
ZeroDivisionError: division by zero
