1.结构操作

1.1.数组转字典

1
2
3
4
5
6
list1 = ['key1','key2','key3']
list2 = ['1','2','3']
dict1 = dict(zip(list1,list2))

print dict1
{'key1':'1','key2':'2','key3':'3'}

1.2.将一个数组按照某个长度拆开

[list(b) for b in zip(*[iter(x)]*n)] + [x[-(len(x)%n):]]