python基础大全--模块操作

python基础大全--模块操作
jwang模块的引用与创建
test1.py |
test2.py |
test3.py |
引用内置库
import os #引进os模块,详见a_test.py |
引用第三方库
安装外部库:pycharm -- preferences -- project interpreter -- + -- '选择库' -- install |
建立自己的库:在需要的文件夹下建立一个__init__.py文件,或者系统自动生成,该文件夹会成为一个库
from module import test1 |
文件读取
r w a -->读 写(会覆盖文件中的内容) 追加写(末尾添加)读写文件性能会很低,因为文件存在磁盘,需要转到CPU运行 |


