当前位置: 代码迷 >> 综合 >> module [摘自core python programing]
  详细解决方案

module [摘自core python programing]

热度:6   发布时间:2024-01-09 23:39:31.0

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]语法将这个模块导入,使这个模块在导入它的模块中变为可用。

 

  相关解决方案