I'm trying to find the number of lines of code within class or function that are stored in a python file my code is like this... what I want is to find number of lines of code in the a class not all the file ... is there any good way to do so??
import inspect
import foo
for a,b in inspect.getmembers(foo):
if inspect.isclass(b):
print a # find a class within the file
From inspect.getsourcelines docs:
That's why you need the 0 index