我的系统上安装了一个 Python 模块,我希望能够查看其中可用的函数/类/方法。
我想在每一个上调用 help
函数。在 Ruby 中,我可以执行类似 ClassName.methods
的操作来获取该类上所有可用方法的列表。 Python中有类似的东西吗?
例如类似:
from somemodule import foo
print(foo.methods) # or whatever is the correct method to call
最佳答案
您可以使用 dir(module)
查看所有可用的方法/属性。另请查看 PyDocs。
关于python - 如何列出模块中的所有功能?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/139180/