Python Forum
filtering a list of dictionary as per given criteria
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
filtering a list of dictionary as per given criteria
#6
(Dec-23-2023, 08:32 AM)jss Wrote: i need to check if a given list of metadata contains detail_in and detail_out present in the name field
You can use the in operator with strings. Note that 'detail_in' is different from 'details_in'
>>> 'details_in' in "unn_details_in_v1.cfg"
True
>>> 'details_in' in "unn_details_out_v1.cfg"
False
>>> 
« We can solve any problem by introducing an extra level of indirection »
Reply


Messages In This Thread
RE: filtering a list of dictionary as per given criteria - by Gribouillis - Dec-23-2023, 08:47 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Sort a list of dictionaries by the only dictionary key Calab 2 741 Apr-29-2024, 04:38 PM
Last Post: Calab
  Dictionary in a list bashage 2 669 Dec-27-2023, 04:04 PM
Last Post: deanhystad
  How to add list to dictionary? Kull_Khan 3 1,110 Apr-04-2023, 08:35 AM
Last Post: ClaytonMorrison
  check if element is in a list in a dictionary value ambrozote 4 2,122 May-11-2022, 06:05 PM
Last Post: deanhystad
  Dictionary from a list failed, help needed leoahum 7 2,139 Apr-28-2022, 06:59 AM
Last Post: buran
  how to assign items from a list to a dictionary CompleteNewb 3 1,710 Mar-19-2022, 01:25 AM
Last Post: deanhystad
  Python, how to manage multiple data in list or dictionary with calculations and FIFO Mikeardy 8 2,785 Dec-31-2021, 07:47 AM
Last Post: Mikeardy
  Class-Aggregation and creating a list/dictionary IoannisDem 1 2,010 Oct-03-2021, 05:16 PM
Last Post: Yoriz
  Python dictionary with values as list to CSV Sritej26 4 3,168 Mar-27-2021, 05:53 PM
Last Post: Sritej26
  convert List with dictionaries to a single dictionary iamaghost 3 2,953 Jan-22-2021, 03:56 PM
Last Post: iamaghost

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020