Python模块创建与使用实验指南.pdfVIP

  • 0
  • 0
  • 约2.17千字
  • 约 6页
  • 2026-03-04 发布于北京
  • 举报

1.打开开发工具PythonIDLE2.创建模块module1.py和module2.py以及

simple.py,代码见各文件

3.在IDLE中编写并运行关于模块的例子

importmodule1

module1.printer(你好)

Hello

importmodule2

module2.printer2(print2)

Helloprint2

importmodule2

module2.abc()

这是在module2的abc中

printer(123)

回溯(一次调用):

文件pyshell#6,第1行,在模块

printer(123)

名称错误:名称printer未定义

frommodule1importprinter

printer(123)

123

frommodule2import*

abc()

这是在module2的abc中

printer2(ddd)

你好ddd

importsimple

简单的模块

simple.spam

1

1.打开开发工具PythonIDLE

2.创建模块module1.py和module2.py以及simple.py,代码见各文件

3.在IDLE中编写运行关于模块的例子

importmodul

文档评论(0)

1亿VIP精品文档

相关文档