Answer the question
In order to leave comments, you need to log in
How to output data from json in order in python?
Python sends different data, sends and parses the response as json from the site and receives:
{"coins":{"Feathercoin":{"tag":"FTC","algorithm":"NeoScrypt","block_time":"62.0","block_reward":80.0,"block_reward24":80.0,"last_block":1594792,"difficulty":9.67974881,"difficulty24":6.89203532549665,"nethash":"670551686.652337419354838709677419354838709677","exchange_rate":6.37e-06,"exchange_rate24":6.3564587973274e-06,"exchange_rate_vol":1.72217233,"exchange_rate_curr":"BTC","market_cap":"$973,964.69","estimated_rewards":"486.6617","estimated_rewards24":"682.3035","btc_revenue":"0.00310","btc_revenue24":"0.00435","profitability":84,"profitability24":116,"lagging":false,"timestamp":1487237252},"Diamond":{"tag":"DMD","algorithm":"Groestl","block_time":"100.0","block_reward":0.2,"block_reward24":0.200000000000002,"last_block":2017546,"difficulty":34.4935945,"difficulty24":28.8405010464706,"nethash":"1481488602.989855","exchange_rate":0.00028468,"exchange_rate24":0.000281315657015593,"exchange_rate_vol":0.16147806,"exchange_rate_curr":"BTC","market_cap":"$559,253.98","estimated_rewards":"12.4774","estimated_rewards24":"14.7149","btc_revenue":"0.00355","btc_revenue24":"0.00419","profitability":96,"profitability24":112,"lagging":false,"timestamp":1487237245}
Answer the question
In order to leave comments, you need to log in
Get to the nested key a la "Feathercoin" via for i in dict_name['coins'] :
>>> d = {'coins': {'Feathercoin': {'tag': 'FTC', 'algorithm': 'NeoScrypt', 'block_time': '62.0'}}}
>>> for i in d['coins']:
print('Coins - ', i, ': ', 'Tag - ', d['coins'][i]['tag'], ': ', 'Algorithm - ', d['coins'][i]['algorithm'])
Coins - Feathercoin : Tag - FTC : Algorithm - NeoScrypt
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question