Python模块和Python包之间有什么区别? [英] What's the difference between a Python module and a Python package?
本文介绍了Python模块和Python包之间有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Python模块和Python包之间有什么区别?
What's the difference between a Python module and a Python package?
另请参阅:"package"与和模块" (用于其他语言)
See also: What's the difference between "package" and "module" (for other languages)
推荐答案
模块是一个文件(一个或多个文件),可通过一次导入将其导入并使用. 例如
A module is a single file (or files) that are imported under one import and used. e.g.
import my_module
包是目录中提供包层次结构的模块的集合.
A package is a collection of modules in directories that give a package hierarchy.
from my_package.timing.danger.internets import function_of_love
这篇关于Python模块和Python包之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文