ev3编程 python_乐高 EV3 高级编程 - 第四课:Python 模块

译者按:使用 ev3dev Linux 系统并用 Python 编程的人数比例很低,好像这一课这样写 Python 编程的就更少了,你会发现程序的重用率会大大的提高!

EV3: Lesson 4 - Python Modules

EV3:第 4 课 - Python 模块

4.1 Separate Functions, Main Program and Global Variables

4.1 分开的函数,主程序,和全局变量

In our last lesson, we learned how to use functions to perform repeated jobs. However, if the main program contains too many functions, the program size will become too large to be maintained. So, we'll need some technique to separate those functions with the main program.

在我们的上一课,我们学习了如何使用函数去执行一些重复的工作。但是,如果主程序里有太多的函数,程序会变得太大而难以维护。所以,我们需要一些技巧去分开主程序和函数。

Those python program files that stored functions are called "Python Modules".

我们叫那些储存函数的档案为【Python 模块】。

In order to share variables between different python programs and modules, we'll also need to put the global variables to a seperate python module. (Note: global var

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值