简体   繁体   English

你怎么能看到你在 Jupyter notebook 中导入的带有星号的 python 模块列表?

[英]How can you see a list of python modules that YOU imported in Jupyter notebook with asterisk?

The title says it all.标题说明了一切。 How do you see it?你怎么看? Sometimes I import every method in a python module with asterisk, and I would like to see a list of all the methods from that module in Jupyter notebook.有时我用星号导入 python 模块中的每个方法,我想在 Jupyter notebook 中查看该模块中所有方法的列表。 Is there a simple command for this?有没有一个简单的命令?

In Python the __all__ module variable is a list containing everything that is imported when using在 Python 中, __all__模块变量是一个列表,其中包含使用时导入的所有内容

from module import *

so simply do this:所以只需这样做:

print(module.__all__)

Further reading: https://docs.python.org/3/tutorial/modules.html#importing-from-a-package进一步阅读: https : //docs.python.org/3/tutorial/modules.html#importing-from-a-package

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM