Python/模块与包之模块
16lz
2021-01-22
Python/模块与包之模块
1.什么是模块?
模块就是py文件
2.为什么要用模块?
如果在解释器上进行编码,把解释器关闭之前写的文件就不存在了,如果使用模块的话就能永久保存在磁盘中。
3.如何使用模块?
3.1 import 通过import导入要使用的模块
1 #spam.py
2 print('from the spam.py')
3
4 money=1000
5
6 def read1():
7 print('spam->read1->money',1000)
8
9 def read2():
10 print('spam->read2 calling read')
11 read1()
12
13 def change():
14 global money
15 money=0
更多相关文章
- eclipse调用python模块是出错及解决
- python3 爬虫之requests模块使用总结
- 面试---Python中的模块和包是什么?
- python及其模块下载集合
- python的turtle模块画折线图
- centos7 安装 Python PIL模块
- Python添加默认模块搜索包路径
- python 装饰器和 functools 模块
- Python 3.x--模块导入