Search for specific value in list of dictionaries and return the Index 

Spread the love

python list of dictionaries

Searching list of dictionaries :

Let’s define a list of dictionaries for our operations.

Now I want to search for callID  dictionary member in above list of dictionaries. I can use python built-in any  function like below.

Above function gives True  if it found the callID   42259bfc-506d3c0e-59d4e928@19.9.7.29  in List otherwise it will give False

Here is the small piece of code to search for specific value in list of dictionaries and return the Index

Search for the specific value in the list of dictionaries and return the Index :

on success, find function returns the dictionary index in the list.  On failure, it will return -1.

 

Venkatesh Macha

Hi Guys, I am Venkatesh Macha. I am a programmer, Presently working as a Software Engineer. I love Linux and Open Source. Apart from that, I love to explore new technologies and things.

You may also like...

Leave a Reply