page_list = []
a = [{'runAsShopTitle': '健足乐旗舰', 'runAsShopId': 569771360, 'cateName': '女鞋', 'uv': 8599, 'payAmt': 330711.16000000184,
'rfdSucAmt': 4258},
{'runAsShopTitle': '健足乐旗舰', 'runAsShopId': 569771360, 'cateName': '流行男鞋', 'uv': 1854, 'payAmt': 13745.939999999984,
'rfdSucAmt': 1523},
{'runAsShopTitle': '健足乐旗舰', 'runAsShopId': 569771360, 'cateName': '男装', 'uv': 93, 'payAmt': 1120.0,
'rfdSucAmt': 0}]
new_list = []
for data in a:
shop = sorted(data.items(), key=
lambda a:1 if a[0] == 'runAsShopTitle' else 2
if a[0] == 'runAsShopId' else 3
if a[0] == 'cateName' else 4
if a[0] == 'uv' else 5
if a[0] == 'cateName' else 6
if a[0] == 'payAmt' else 7
)
shop_list = []
for i in shop:
shop_list.append(i[1])
new_list.append(shop_list)
print(new_list)
log.txt
[
['健足乐旗舰', 569771360, '女鞋', 8599, 330711.16000000184, 4258],
['健足乐旗舰', 569771360, '流行男鞋', 1854, 13745.939999999984, 1523],
['健足乐旗舰', 569771360, '男装', 93, 1120.0, 0]]
网友评论