import my_info as info
print(info.name)
info.show()
from my_info import *
print(name)
show()
pyhon中包的导入
import admin.my_admin as ad # 包名.模块名 admin是包名,my_admin是模块名
print(ad.name)
print(ad.info())
from admin import my_admin as ad # from包名 import模块as别名
ad.info() #
from admin.my_admin import info
info()
# 在整个执行过程中,__ini__代码只被执行一次
from admin.my_admin import *
主程序运行:
if __name__ == '__main__':
print("this test code model a")
name = "ysa"
print(name)