Unpacking Argument Lists
2024-08-26 04:18:56
[Unpacking Argument Lists]
The reverse situation occurs when the arguments are already in a list or tuple but need to be unpacked for a function call requiring separate positional arguments. For instance, the built-in range()function expects separate start and stop arguments. If they are not available separately, write the function call with the *-operator to unpack the arguments out of a list or tuple:
In the same fashion, dictionaries can deliver keyword arguments with the **-operator:
参考:http://docs.python.org/2.7/tutorial/controlflow.html#unpacking-argument-lists
最新文章
- sqlserver中DATE类型的数据转化 CONVERT
- eclipse的包的加减号展开方式
- 统计Codec RAM和ROM方法
- JS常用的设计模式(17)—— 状态模式
- 网络流量监控shell脚本
- JavaScript 中的算术运算
- MongoDB - The mongo Shell, Access the mongo Shell Help
- 【CSS3】---background-origin background-clip background-size
- Lucas定理的理解与应用
- Axis2 WebService(基于REST风格)
- Element ui 日期限制范围
- LVS负载均衡基础介绍及NET、DR模式配置
- css居中小技巧
- 下载m3u8视频
- 运行vs2010,Debug时发生“无法启动程序";http://localhost:xxx";,系统找不到指定文件
- 使用Arduino模块实施无线信号的重放攻击
- CountDownLatch的简单理解
- openstack系列文章(二)
- mysql 截取字符串
- Django分页的实现