Python的字典的items(), keys(), values()

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

  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'), (1, 2), ('hello', 'world')]  

 

posted @ 2017-07-19 11:07  程序猿-小秦  阅读(3244)  评论(0编辑  收藏  举报