Python中模块import的使用案例

1 import test  # 导入test模块
2
3 print(test.a)  # 使用“模块.变量”调用模块中的变量
4 
5 test.hi()  # 使用“模块.函数()”调用模块中的函数
6 
7 A = test.Go2()  # 使用“变量 = 模块.类()”实例化模块中的类
8 print(A.a)  # 实例化后,不再需要“模块.”
9 A.do2()  # 实例化后,不再需要“模块.”
原文地址:https://www.cnblogs.com/Through-Target/p/12186616.html