实参中的*args和**kwargs
时间: 2023-09-09 22:12:19 浏览: 117
*args和**kwargs是Python中的特殊参数,用于处理超出必备参数部分的参数。在函数定义时,*args表示接受任意数量的位置参数,这些参数将以元组的形式传递给函数。而**kwargs表示接受任意数量的关键字参数,这些参数将以字典的形式传递给函数。需要注意的是,*args必须放在**kwargs的前面,因为位置参数在关键字参数的前面。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [Python中*args 和**kwargs作为形参和实参时的功能详解](https://blog.csdn.net/weixin_39731107/article/details/110774156)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [Python中*args和**kwargs的使用方法](https://blog.csdn.net/weixin_43981621/article/details/121557014)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文