python中zip的应用

#!/usr/bin/env python
#_*_coding:utf-8_*_

from random import shuffle

a = [1, 2, 3, 4]
shuffle(a)
b = sorted(a)
temp = zip(a, b)
print temp
result = dict(temp)
print result

temp1 = zip(*temp)
print temp1

a1 = list(temp1[0])
b1 = list(temp1[1])
print a1, b1
posted @ 2018-02-27 22:44  沧海小龙虾  阅读(143)  评论(0编辑  收藏  举报