模块:.py文件,独立逻辑,独立功能,import重复利用。
包:多模块,包里必有一个__init__.py,初始化。
模块 test_module.py
包 test_package
import 模块
import test_module 当前代码中创建了一个test_module对象
test_module.py中的变量和函数相当于是test_module对象的属性和方法
test_module.属性名() test_module.方法名() 调用模块中的内容
from test_module import *把test_module.py中的代码导入到当前环境
import包
import test_package 导入包会自动执行包中的__init__.py文件
from test_package import 模块1
from test_package import 模块2
包名.模块名.函数名()
test_package.test_module.test()