How to get a list of variables in specific Python module?

前端 未结 5 827
野趣味
野趣味 2020-11-30 10:42

Let\'s assume I have the following file structure:

data.py

foo = []
bar = []
abc = \"def\"

core.py

5条回答
  •  没有蜡笔的小新
    2020-11-30 11:26

    print [item for item in dir(adfix) if not item.startswith("__")]
    

    Is usually the recipe for doing this, but it begs the question.

    Why?

提交回复
热议问题