一.模块:用一个或者多个.py文件来实现某个功能的代码集合,提供了代码的重用性和代码间的耦合。
而对于一个复杂的功能而言,可能需要多个函数相互调用才能完成,函数也可以在不同的.py文件
中,这n个.py文件的代码集合就称为模块
二.模块与库的关系:一个库可能包含了很多的模块,但一个库至少有一个模块
模块的种类:
- 内置模块:类似于sys,os,getpass,socket,time....
- 自定义模块:
- 第三方模块
三.导入自定义模块的方法与注意事项:
注意事项1:尽量避免使用IDE添加的模块搜索路径
对于相同的代码。在缺少pycharm的编辑环境下,就无法识别模块'mokuai2'