下面是JSON内容:
{'status': '1', 'message': 'OK',
'result': {'LastBlock': '14934113', 'SafeGasPrice': '119', 'ProposeGasPrice': '119', 'FastGasPrice': '119',
'suggestBaseFee': '118.174590189', 'gasUsedRatio': '0.025821954106323,0.354559890356924,0.173050329701518,0.340210087647076,0.0269005272339711'}}
字符串
如何从'result'
中获取字符串?我想得到'SafeGasPrice'
2条答案
按热度按时间z31licg01#
我首先从result中获取值:
gas_unit_price = gas_unit_price.json()["result"]
第二次得到我需要的字符串:gas_unit_price = gas_unit_price["FastGasPrice"]
个bvn4nwqk2#
字符串