Python AST: Parsing loop lengh using is missing line numbers -
i trying parse line numbers of loop using python ast. using ast.walk
for in ast.walk(file): if isinstance(i,(ast.while,ast.for)): start=i.lineno; end=i.body[-1] while isinstance(end,(ast.while,ast.for,ast.if)): end = end.body[-1] what trying offset node, when like;
attributeerror: 'if' object has no attribute 'body'.
i need can line numbers start of loop end.
Comments
Post a Comment