module [摘自core python programing]

本文详细介绍了Python模块的概念,包括如何将相关代码物理组织到独立文件中,模块内的可执行代码、函数、类等内容,以及如何通过import语句在其他模块中导入和使用这些模块。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

A module is a logical way to physically organize and distinguish related pieces of Python code into individual files.

模块是一种从物理上将相关的python代码分别放到各自独立的文件上的组织方式。

A module can contain executable code,functions, classes, or any and all of the above.

模块里可以包含可执行代码 和 方法、类(、变量)的定义。

 

When you create a Python source file, the name of the module is the same as the file except without the trailing .py extension.

当你创建了一个python源文件后,这个文件的文件名去掉 这个后缀[.py] 后的名字也就是这个文件对应的模块的名字。

Once a module is created,you may import that module for use from another module using the import statement.

当一个模块被创建后,你就可以在其它模块中使用 [import]语法将这个模块导入,使这个模块在导入它的模块中变为可用。

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值