在python中列出所有导入的模块的最佳方法是什么?
问题描述:
通常,在交互模式下进行数值SciPy/NumPy计算几个小时后,就会加载一堆模块.
Usually, after doing numerical SciPy/NumPy calculations in the interactive mode for several hours, a bunch of modules become to be loaded.
有什么好的方法可以从交互式python命令行查看导入的模块列表吗?
Are there any good ways to see the list of imported modules from the interactive python command line?
谢谢!
答
使用sys.modules
:
import sys
print '\n'.join(sys.modules)