python zip

#!/usr/local/env python2
  >>> x = [1,2]
  >>> y = [5,6]
  >>> xy = zip(x,y)
  >>> type(xy)
    <type 'list'>
  >>> print xy
    [(1, 5), (2, 6)]
  >>> print dict(xy)
    {1: 5, 2: 6}

 

posted @ 2016-01-14 13:59  卡卡v西西  阅读(90)  评论(0编辑  收藏  举报