Find functions explicitly defined in a module (python)

后端 未结 5 2002
北恋
北恋 2020-12-03 04:48

Ok I know you can use the dir() method to list everything in a module, but is there any way to see only the functions that are defined in that module? For example, assume m

5条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-03 05:35

    Every class in python has a __module__ attribute. You can use its value to perform filtering. Take a look at example 6.14 in dive into python

提交回复
热议问题