Python_API_Built-in Types_dict.update
来源:互联网 发布:金蝶k3软件下载 编辑:程序博客网 时间:2024/06/04 17:55
- update([other])
Update the dictionary with the key/value pairs fromother, overwriting existing keys. ReturnNone.
update() accepts either another dictionary object or an iterable of key/value pairs (as tuples or other iterables of length two). If keyword arguments are specified, the dictionary is then updated with those key/value pairs:d.update(red=1,blue=2).
Changed in version 2.4:Allowed the argument to be an iterable of key/value pairs and allowed keyword arguments.
- update([other])
- 将参数other映射到dictionary中,返回None
- 该方法接受另一个字典对象或一个键/值对迭代(长度为二的元组或其他iterables)。如果指定关键字参数,然后用这些键/值对更新字典:d.update(红色,蓝色= 1= 2)。
- 例:#! /usr/bin/env python
#coding=utf-8
dict={'name':'lyle','id':'l'}
print type(dict)
print dict
dict.update(name=1)
print dict
a = (('a','b'),('1','2'))#注意这里必须是2个以上
dict.update(a)
print a
dict.update({'title':'title1','id':'2'})
print dict
- 输出:<type 'dict'>
{'name': 'lyle', 'id': 'l'}
{'name': 1, 'id': 'l'}
(('a', 'b'), ('1', '2'))
{'a': 'b', '1': '2', 'name': 1, 'title': 'title1', 'id': '2'}
- Python_API_Built-in Types_dict.update
- Python_API_Built-in Functions_locals
- Python_API_Built-in Functions_globals
- update in .net
- 关于IN UPDATE TASK
- 关于IN UPDATE TASK
- Update TensorFlow in Mac
- update files in the Eclipse
- update with case and in
- "select ... for update" in eXtremeDB
- Catalogue/update in 2017.12.07
- update any table in database by transcation
- InnoDB: error in sec index entry update
- Update field with row_num in MYSQL
- mysql update in 嵌套子查询更新
- Product Tier Price add/update in Magento
- Fast Updates with MongoDB (update-in-place)
- Update a driver in an initrd file
- 在MFC下如何定义全局变量和全局函数
- 遍历集合下的按钮
- Oracle DataGuard 物理Standby 搭建(下)
- 面向过程和面向对象的一点区别
- document.createElement()的用法
- Python_API_Built-in Types_dict.update
- ajax jquery js 提交(添加)
- 马和驴的故事
- 软件自动更新思路
- wget用法集合
- 事业选择:学术界与企业界科学家的区别
- Oracle 碎片整理
- REHL5安装SVN
- Android 新手常见的10个误区(上)