我正在使用eclipse中的交互式控制台,并且重新加载不会在我的代码中显示更新的函数。我的代码是:
def func1():
return 1
def func2():
return 2
但是当我把它改为
时def afunc1():
return 1
def func2():
return 2
def func1():
return 3
并运行了imp.reload(TestMod),我得到了'module' object has no attribute 'afunc1()'
此外,有时函数会被加载,有时它们不会被加载。
答案 0 :(得分:0)
事实证明,当我点击ctl-s时,eclipse没有保存文件(或者没有保存到正确的位置)。为了使它工作,我必须在Package Explorer中右键单击文件名,然后选择使用PyDev打开并将其保存在
下