python函數參數傳遞規則

1、聲明一個參數具有默認值參數的函數,如下: def hello(name = 'python')     print('你好',name) ---無參數傳遞直接調用函數,則爲:你好,python--(hello) ---有參數傳遞時,如:hello('小明')--結果爲:你好,小明 2、默認參數調用 def sum(a=1,b=2,c=3)     sum_abc=a+b+c 無參數時有sum_
相關文章
相關標籤/搜索