现在的位置: 首页 > 综合 > 正文

Python学习笔记一

2018年04月13日 ⁄ 综合 ⁄ 共 263字 ⁄ 字号 评论关闭

一、字典的使用

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

[python] view
plain
copy

  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. >>>   

抱歉!评论已关闭.