您的位置:首页 > 编程语言 > Python开发

从0开始学python:字典dictionary

2013-08-09 10:47 197 查看
Python的字典的items(), keys(), values()都返回一个list

[python] view
plaincopy

>>> dict = { 1 : 2, 'a' : 'b', 'hello' : 'world' }

>>> dict.values()

['b', 2, 'world']

>>> dict.keys()

['a', 1, 'hello']

>>> dict.items()

[('a', 'b'), (1, 2), ('hello', 'world')]

>>>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: