当我用python重新加载模块时,模块的新代码在语法上不正确,会发生什么?重载(模块)函数似乎没有引发任何异常。有没有办法确定重新加载是成功还是失败?
In [34]: import test # This works fine
在test.py中出现语法错误后:(已更改导入-->pimport)
In [35]: reload(test) ------------------------------------------------------------ File "/home/unutbu/pybin/test.py", line 2 pimport itertools ^ SyntaxError: invalid syntax