Travel Agency

Getting module name with ast

:(def visit_Module(self, node
 print"Module : %s"% node
I basically need the actual module name If it is inside a package then the complete one like a.b.module

Python: IndentationError: expected an indented block


:if len (trashed_files) == 0



From executing Python code, you can use __name__ and __package__ from inside Python code

AST Nodes

 

The compiler.ast module is generated from a text file that describes each node type and its elements. Each node type is represented as a class that inherits from the abstract base class compiler.ast.Node and defines a set of named attributes for child nodes

Sources

Python.org
Stackoverflow.com

کلمات کلیدی:


نوشته شده توسط Abteen 94/9/24:: 6:48 عصر     |     () نظر