NameError: name 'reload' is not defined

前端 未结 4 1326
忘了有多久
忘了有多久 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:53

    You probably wanted importlib.reload().

    from importlib import reload
    

    In Python 2.x, this was a builtin, but in 3.x, it's in the importlib module.

    Note that using reload() outside of the interpreter is generally unnecessary, what were you trying to do here?

提交回复
热议问题