【发布时间】:2020-02-19 05:17:11
【问题描述】:
x=json.dumps(result)
print(x)
输出:
['Client Name:'Sriram',
'Trade Date :'03-09-2019',
'Security :CERAMICIST-ICICLE,NAT CO - PHARMA',
'Quantity:14,2',
'Net Rate: 145.7500,552.3725',
'Buy/Sell :'Buy ', 'Buy',
'Net Total:2040.5000,1104.7450']
我想将此列表转换为 json 格式,如下所示:
{'Client Name': Sriram',
'Trade Date' :03-09-2019',
'Security' :['CERAMICIST-ICICLE','NAT CO - PHARMA',
'Quantity':'14,2',
'Net Rate':['145.7500','552.3725'],
'Buy/Sell':['Buy','Sell',
'Net Total':['2040.5000','1104.7450']
【问题讨论】:
-
请分享您的清单
-
['TradeDate :03-09-2019', 'Security :ICICIPRAMCICICI500', 'Quantity :14', 'NetSale: 145.7500', 'Buy/Sell :2040.5000BuyINF109KC1CZ3']
-
等一下...您的结果不是有效的 json。你的意思是
{'TradeDate' : '03-09-2019', ...}还是['TradeDate :03-09-2019',....]? -
如果有人解决了你的问题,别忘了点赞并接受答案。如果您的问题仍然存在,请评论问题所在!
-
是的,有问题