python学习笔记三 模块
来源:互联网 发布:电玩巴士官方淘宝店 编辑:程序博客网 时间:2024/06/05 19:30
最简单创建模块的方法就是创建以.py结尾的扩展名的文件,在文件中包含函数和变量。
例一:helloworld模块
模块原型:
#helloworld.py<pre name="code" class="python"><pre name="code" class="python" style="font-size:10px;"><span style="font-size:10px;">def hello(): print("hello world!")__version__ = '0.1'</span>
模块使用效果:
<pre name="code" class="python" style="font-size:10px;">#test.py
<span style="font-family:Arial, Helvetica, sans-serif;">import helloworld</span>
helloword.hello()print("version",helloworld.__version__)
注意:helloworld.py必须和test.py在同一个文件夹
输出结果:
hello world!
('version', '0.1')
0 0
- python学习笔记三 模块
- Python模块--Python学习笔记三
- [转载]Python学习笔记三(常用模块)
- python学习笔记(三):python构建与安装模块
- Python学习笔记(三)——模块|面向对象
- Python学习笔记(三)函数、面向对象、模块发布
- Python学习笔记----模块
- Python学习笔记----模块
- Python学习笔记--模块
- 【Python学习笔记】模块
- Python学习笔记-模块
- Python模块学习笔记
- Python学习笔记(三)Python模块、模块导入和重载
- 【python学习】之三、模块
- python学习之三 模块
- python学习笔记三
- python学习笔记三
- python学习笔记:三
- codevs 1065 01字符串 题解报告
- 使用mysql_upgrade升级mysql5.1至5.6的数据库升级实施方案
- hdu 1041 Computer Transformation(递推+大整数模板*)
- 基于php+mysql实现分页技术
- 查找介于n1与n2(0<n1<n2<32768)之间所有满足下列条件的整数: (1)该数的十进制表示中有且仅有两个相同的数字位; (2)该数是素数
- python学习笔记三 模块
- 《Linux操作系统》笔记
- MyProgramLife(01) ---- 表单验证
- Spannable的使用(文本样式设置)
- 模式识别作业3
- Docker扁平化网络如何实现?
- 怎样理解一个复杂的c语言声明
- NOIP2011复赛提高组day2(A:计算系数 B:聪明的质监员 C:观光公交)
- 虐杀原型二简单分析