I have this huge JSON file, which contains more than 80000 lines, looking like that:
{u'hero_name': u'bristleback', u'gold_total': 17937, tick:24098}
{u'hero_name': u'silencer', u'gold_total': 10847, tick:24198}
{u'hero_name': u'silencer', u'gold_total': 11789, tick:25098}
{u'hero_name': u'weaver', u'gold_total': 27084, tick:27098}
There are 10 different heroes with their gold data. I want to sort that data for the hero names, make a json list of the gold data, and then store it in a databse table looking like that, where gold_data should be like [{tick, gold}, {tick, gold}, ...]
id | hero_name | gold_data (json field) | ...
But seems like i am too stupid to sort that. I tried building a list out of it and using sorted(gold_list, key=lambda s: s[0])
I am just not too comfortable with Python yet and I tried so many different things, but i have no idea how to sort,and then split this dictionary for the hero_names key so I can get that JSON object for gold_data