For efficiency reasons, each module is only imported once per
interpreter session. Therefore, if you change your modules, you must
restart the interpreter – or, if it’s just one module you want to test
interactively, use reload(), e.g. reload(modulename).
每个会话加载一次模块,更改时必须重新加载。在
从Python tutorial on modules:
您面临的问题是IDLE已经导入并构建了模块的内部表示。在磁盘上编辑文件不会反映到现在导入的内存驻留版本处于空闲状态。你应该能够得到你想要的行为:
example315 = reload(example315)
这里有一些来源:Python Docs Source
相关问题 更多 >
编程相关推荐