Sherman IT
12 April 2022
How to debug or test python scripts using inspect module and print and input?
https://stackoverflow.com/questions/3056048/filename-and-line-number-of-python-script
At the top of your script,
from inspect import currentframe, getframeinfo
At the spot where you want to print the value of a variable,
print(f'Line #{
getframeinfo(currentframe())
.lineno}:\nDescription:\n{varName}\nEnd of Description
\n')
input()
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment