- 模块与包
- 模块的导入和定位
- 导入:import xx
- 定位:当前包-->内置函数-->sys.path(环境变量)
- 模块的属性
- dir------------------列出对象的所有属性及方法 dir(xxxx)
- help----------------查看列,方法的帮助信息
- __name__--------模块的名称 hello.__name__
- __file__------------文件全路径
- 包的简介
- 用来组织模块
- 必须包含文件__init__.py
- 模块重名问题解决
- 包的引用
- 引入整个包:import module
- 引入所需要的属性和方法:from module.xx.xx import xx
- 指定别名:from module.xx.xx import xx as 别名
- 引入所有:from module.xxx import *
__init__.py
import . from xx
Python-模块与包
原文:https://www.cnblogs.com/ZZBD/p/12551934.html