-3

这就是我所拥有的

d= [{'abc':1,'cde':2},
    {'abc':3,'cde':4},
    {'abc':5,'cde':6},
    {'abc':7,'cde':8}]

这就是我要的:

abc = [1,3,5,7]
cde = [2,4,6,8]
4

2 回答 2

5
abc, cde = [x['abc'] for x in d], [x['cde'] for x in d]
于 2013-11-07T19:31:59.940 回答
0
abc = [item['abc'] for item in d]
cde = [item['cde'] for item in d]
于 2013-11-07T19:33:20.053 回答