Answers for "how to get a dictionary key in a list json python"

6

list of dictionaries to json python

import json

with open('data.json', 'w') as fp:
    json.dump(data, fp)
Posted by: Guest on August-26-2020
0

list keys json python

>>> dct = {
...     "1": "a", 
...     "3": "b", 
...     "8": {
...         "12": "c", 
...         "25": "d"
...     }
... }
>>> 
>>> dct.keys()
['1', '8', '3']
>>> for key in dct.keys(): print key
...
1
8
3
>>>
Posted by: Guest on April-29-2021

Code answers related to "how to get a dictionary key in a list json python"

Python Answers by Framework

Browse Popular Code Answers by Language