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"和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屋!
查看全文