Python *arg **kwarg

函數定義時傳*arg /**kwarg(收集參數) 函數傳入*arg def print_params(title, *arg): print title print arg 測試一下:python >>> print_params('params', 1, 2) params (1, 2) Explain:(1,2)是元組的形式;函數的位置參數爲*arg,說明函數接受的是一個元組
相關文章
相關標籤/搜索