python 自定义函数。
来源:互联网 发布:语音王软件 编辑:程序博客网 时间:2024/05/18 02:29
python里的自定义函数特么的真简单。简单到爆!
>>> def eat(sth)
SyntaxError: invalid syntax>>> def eat(sth):print(sth)>>> eat(apple)Traceback (most recent call last): File "<pyshell#24>", line 1, in <module> eat(apple)NameError: name 'apple' is not defined>>> eat("apple")apple>>>
def 函数名(参数):
函数体
早已经被python没有各种结束符打败了,看看函数,连参数都不需要定义数据类型,函数定义也要标新立异,大部分语言都是用function ,这货偏偏要用def
,def不是C里预处理的么,有点理解不来。
python里的一切函数、结构体、循环都是用:开始的,没有结束符。程序的可读性会变差。没法像C那样,一块块的,我爱写几个函数就写几个函数,互相调用再实例化,各种爽,python 看都看不来,看来是很考验写注释的功力啊。
- Python--函数,自定义函数
- python 自定义函数。
- Python学习--自定义函数
- python自定义函数
- Python中的自定义函数
- python自定义排序函数
- Python学习 自定义函数
- 小白学Python自定义函数
- Python/自定义排序函数
- Python变量、自定义函数
- Python 自定义函数
- python自定义函数(一)
- python自定义函数(二)
- Python不定参数自定义函数
- python学习笔记:自定义函数
- python中自定义排序函数
- python中自定义排序函数
- Python中的自定义sum函数
- workspace\.metadata\.plugins\org.eclipse.wst.server.core
- 中国也曾有过贵族:春秋战国是其黄金时期
- parallels7安装windows7失败原因
- jquery ajax php 二级联动
- Flex 开发gSOAP的客服端
- python 自定义函数。
- xcode 4.2 调试 添加命令行参数
- What I Have Learned From My First Scientific Research
- Ubuntu 11.04下虚拟机Samba的共享配置详细步骤
- compare operation in shell
- android 中使用ksoap2来连接webServices
- Python and IRC
- js 操作cookie
- 3g