Reload a Module in Python 3.4 [duplicate]

人走茶凉 提交于 2019-11-30 08:15:43
iCodez

The imp module was deprecated in Python 3.4 in favor of the importlib module. From the documentaion for the imp module:

Deprecated since version 3.4: The imp package is pending deprecation in favor of importlib.

So, you should be using the reload function from there:

>>> import importlib
>>> importlib.reload
<function reload at 0x01BA4030>
>>> importlib.reload(the_module)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!