NameError: name 'reload' is not defined

前端 未结 4 1317
忘了有多久
忘了有多久 2020-12-08 18:22

I\'m using python 3.2.2. When I write a simple program, I meet the problem.

>>> reload(recommendations)
Traceback (most recent call last):
  File \"         


        
4条回答
  •  庸人自扰
    2020-12-08 18:42

    Try importlib.reload.

    Reload a previously imported module. The argument must be a module object, so it must have been successfully imported before. This is useful if you have edited the module source file using an external editor and want to try out the new version without leaving the Python interpreter.

    from importlib import reload
    
    reload(module_name)
    

提交回复
热议问题