For Techs.... Techniques.... Technologies....


How to iterate over list of dictionary in Python

We can use the enumerate functionality in Python to iterate list of dictionary.

Sample script is given below.

names = [{'name':'test1'},{'name':'test2'},{'name':'test3'}]
for name in enumerate(d['name'] for d in names):
    print (name)

This will print each name one by one from the list of dictionary.

That's all…

Leave a Reply