mirror of https://github.com/TwoWater/Python
update List & Dict
parent
253d5e7cdc
commit
4e014c7e51
|
@ -180,7 +180,7 @@ print(name)
|
|||
|[1, 2, 3] + [4, 5, 6]| [1, 2, 3, 4, 5, 6]| 组合|
|
||||
|['Hi!'] * 4|['Hi!', 'Hi!', 'Hi!', 'Hi!']|复制|
|
||||
|3 in [1, 2, 3]|True|元素是否存在于列表中|
|
||||
|for x in [1, 2, 3]: print x,|1 2 3|迭代|
|
||||
|for x in [1, 2, 3]: print(x)|1 2 3|迭代|
|
||||
|
||||
|
||||
## 7、List (列表)函数&方法 ##
|
||||
|
|
|
@ -190,7 +190,7 @@ print(dict1)
|
|||
|dict.clear()|删除字典内所有元素|
|
||||
|dict.copy()|返回一个字典的浅复制|
|
||||
|dict.values()|以列表返回字典中的所有值|
|
||||
|popitem()|随机返回并删除字典中的一对键和值|
|
||||
|dict.popitem()|随机返回并删除字典中的一对键和值|
|
||||
|dict.items()|以列表返回可遍历的(键, 值) 元组数组|
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue