python 字典的定义以及方法

  

 

 7.字典的转换:

   dict(x=1,y=2)  ==>  {'y': 2, 'x': 1}

 dict([(i,element) for i, element in enumerate(['one', 'two', 'three'])])  ==>  {0: 'one', 1: 'two', 2: 'three'}

  dict(zip((0,1),(0,2)))  ==> {0: 0, 1: 2}

原文地址:https://www.cnblogs.com/peiminer/p/9144393.html