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

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

Hi Guys, I am Venkatesh. I am a programmer and an Open Source enthusiast. I write about programming and technology on this blog.

You may also like...

Leave a Reply