发布时间:2019-07-23 09:40:11编辑:auto阅读(1740)
当使用reload时,这个模块会被重新编译,新的模块替换原来的模块。如果之前从这个模块创建的实例仍然使用旧的模块实现。特别是使用from-import语句加载的名称,也不会被更新。
例如:
# File: builtin-reload-example-1.py
from imp import reload
import hello
reload(hello)
reload(hello)=== RESTART: D:/work/csdn/python_Game1/example/builtin-reload-example-1.py ===
hello again, and welcome to the show
hello again, and welcome to the show
hello again, and welcome to the show
>>>
这里helo.py代码如下:
print('hello again, and welcome to the show')
上一篇: SQLite3中文编码 Python
下一篇: [python]map方法与并行执行
51304
50754
41350
38160
32632
29530
28377
23251
23219
21541
1616°
2349°
1954°
1896°
2226°
1936°
2623°
4402°
4243°
3015°