从0开始学python:字典dictionary

来源:互联网 发布:什么评价会被淘宝删除 编辑:程序博客网 时间:2024/05/19 03:45

Python的字典的items(), keys(), values()都返回一个list

[python] view plaincopy
  1. >>> dict = { 1 : 2'a' : 'b''hello' : 'world' }  
  2. >>> dict.values()  
  3. ['b'2'world']  
  4. >>> dict.keys()  
  5. ['a'1'hello']  
  6. >>> dict.items()  
  7. [('a''b'), (12), ('hello''world')]  
  8. >>>