列表推导式
A = [i for i in range(0,10)]
B = [ i**2 for i in A]
字典推导式
for k,v in zip(['a','b','c','d'],[1,2,3,4]):
print(k,v)
d = { key:value for (key,value) in zip(['a','b','c','d'],[1,2,3,4])}
d
A = [i for i in range(0,10)]
B = [ i**2 for i in A]
for k,v in zip(['a','b','c','d'],[1,2,3,4]):
print(k,v)
d = { key:value for (key,value) in zip(['a','b','c','d'],[1,2,3,4])}
d