I have two lists
a=[\"USA\",\"France\",\"Italy\"]
b=[\"10\",\"5\",\"6\"]
I want the end result to be in json like this.
[{\
Using list comprehension:
>>> [{'country': country, 'wins': wins} for country, wins in zip(a, b)]
[{'country': 'USA', 'wins': '10'},
{'country': 'France', 'wins': '5'},
{'country': 'Italy', 'wins': '6'}]
Use json.dumps to get JSON:
>>> json.dumps(
... [{'country': country, 'wins': wins} for country, wins in zip(a, b)]
... )
'[{"country": "USA", "wins": "10"}, {"country": "France", "wins": "5"}, {"country": "Italy", "wins": "6"}]'