模块导入

例子:
file2 定义了函数和变量

file1 导入进行调用

值得注意的是:file2 和 file1 中都定义了一个函数 test1() ,如果使用 import demo.file2 或 from demo.file2 import * 这2种方式导入模块的话,直接调用 test1() 将调用的是file1 中的函数,会引起函数名调用冲突。所以,使用 from demo.file2 import test1() , test2() 这种方式,调用 demo.file2.test1() 会更加清晰明确。
浙公网安备 33010602011771号