You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
def test(name):
'this is a test'
print(test.__doc__)
print('***')
help(test)
#输出结果
this is a test
***
Help on function test in module __main__:
test(name)
this is a test
抽象
所有的函数的确都有返回值,当函数中没有存在返回值的时候,就返回None.
类似于Java,函数的参数如果是基本类型(字符串,数字以及元组),则传入的实际上为拷贝的值,在函数内改变该参数的值并不会影响原来的参数.而当传入Object或者list之类的时候,在其中改变参数的值会影响原来的list或者object.如果不想对该类参数进行修改,可以使用切片或者deepcopy().