Python学习入门基础教程(learning Python)--2.3 Python自定义函数传参
Python里自定义子函数时,可以在调用时携带一些参数到子函数里去处理。具体用法结构如下:
[python]
view plain
copy
def func(arguments):
statement
statement
etc.
[python]
view plain
copy
#define function: print_msg
def print_msg(str):
print(str)
#define main
def main():
print("call sub function print_msg")
print_msg("jeapedu")
#programme
main()
[python]
view plain
copy
jeapedu
转载于:https://blog.51cto.com/witting/1248120