在Python中调用函数
定义函数只会为其命名,指定要包含在函数中的参数,并构成代码块。
一旦确定了函数的基本结构,即可通过从另一个函数或直接从Python提示符处调用它来执行它。以下是调用printme()函数的示例-
#!/usr/bin/python
# Function definition is here
def printme( str ):
"This prints a passed string into this function"
print str
return;
# Now you can call printme function
printme("I'm first call to user defined function!")
printme("Again second call to the same function")输出结果
执行以上代码后,将产生以下结果-
I'm first call to user defined function! Again second call to the same function
热门推荐
10 最搞笑生日祝福语简短
11 婶婶生日贺词简短祝福语
12 婚庆花篮祝福语简短大气
13 诗词文案祝福语简短精辟
14 航空公司祝福语简短
15 节日祝福语幽默简短的
16 年末祝福语简短的文案
17 新婚祝福语大全简短精炼
18 出阁祝福语简短句子