Looping over JSON keys

JSON data can be looped on its keys and values:

for keys,values in d['hits']['hits'][0].items(): 
print(keys)

We receive the following output:

Printing keys of the loaded JSON by looping over the keys and values

We can print both the keys and values together as well.

for keys,values in d['hits']['hits'][0].items():
print(keys,values)

We receive the following output:

Printing keys and values of the loaded JSON by looping over the keys and values

Now, we will look at how to use reading and writing operations with exotic file formats. 

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.221.231.97