- 看漫画学Python:有趣、有料、好玩、好用(全彩版)
- 关东升
- 112字
- 2025-02-24 06:31:36
2.7 动动手——实现两个模块间的代码元素访问
(1)在同一文件夹下创建两个模块hello和world,即两个代码文件:hello.py和world.py。
(2)world模块的代码如下:

(3)hello模块的代码如下:

(4)hello模块是程序的入口,如果需要运行hello.py文件,则可通过Python的如下指令运行。


(1)在同一文件夹下创建两个模块hello和world,即两个代码文件:hello.py和world.py。
(2)world模块的代码如下:
(3)hello模块的代码如下:
(4)hello模块是程序的入口,如果需要运行hello.py文件,则可通过Python的如下指令运行。