Python标准库:内置函数dict(mapping, **kwarg)
来源:互联网 发布:java执行ping命令 编辑:程序博客网 时间:2024/04/29 15:56
本函数是从一个映射函数对象构造一个新字典。与dict(**kwarg)函数不一样的地方是参数输入是一个映射类型的函数对象,比如zip函数、map函数。
例子:
#dict()#以键对方式构造字典d1 = dict(one = 1, two = 2, a = 3)print(d1)#以映射函数方式来构造字典d2 = dict(zip(['one', 'two', 'three'], [1, 2, 3]))print(d2)
输出结果如下:
{'a': 3, 'one': 1, 'two': 2}
{'three': 3, 'two': 2, 'one': 1}
蔡军生 QQ:9073204 深圳
1 0
- Python标准库:内置函数dict(mapping, **kwarg)
- Python标准库:内置函数dict(**kwarg)
- Python标准库:内置函数dict(iterable, **kwarg)
- python字典构造函数dict(mapping)解析
- python字典构造函数dict(mapping)解析
- Python标准库:内置函数abs(x)
- Python标准库:内置函数all(iterable)
- Python标准库:内置函数any(iterable)
- Python标准库:内置函数ascii(object)
- Python标准库:内置函数bin(x)
- Python标准库:内置函数callable(object)
- Python标准库:内置函数chr(i)
- Python标准库:内置函数classmethod(function)
- Python标准库:内置函数dir([object])
- Python标准库:内置函数float([x])
- Python标准库:内置函数frozenset([iterable])
- Python标准库:内置函数globals()
- Python标准库:内置函数hash(object)
- tomcat下禁用不安全的http方法
- WebKit绘制
- 校园助手APP--WebView显示校园贴吧
- JavaBean简介
- 设计模式三部曲--4
- Python标准库:内置函数dict(mapping, **kwarg)
- 在访问者模式中使用反射
- 每个程序员都应读的30本书
- call stack详解
- 【AppScan深入浅出】修复漏洞:启用不安全的HTTP方法 (中)
- easyui datagrid自定义操作
- 自定义textfile样例
- C语言求π的值(2种方法)
- 最简单例子图解JVM内存分配和回收