当我们加载了某个模块后,如果该模块有变动,那么就需要重新加载该模块了。
Python 2加载模块:
Python2 中可以直接使用reload(module)重载模块。
Pyhton 3加载模块:
>>> import importlib
>>> importlib.reload(de_tree)
>>> <module 'part_3.decision_tree' from 'F:\\Program\\python program\\MachineLearningInAction\\part_3\\decision_tree.py'>
>>> from importlib import reload
>>> reload(de_tree)
>>> <module 'part_3.decision_tree' from 'F:\\Program\\python program\\MachineLearningInAction\\part_3\\decision_tree.py'>