Answers for "check values in dictionary python with any"

1

python test if list of dicts has key

>>> lod = [{1: "a"}, {2: "b"}]
>>> any(1 in d for d in lod)
True
>>> any(3 in d for d in lod)
False
Posted by: Guest on December-19-2019
1

check if dict key contains specific key and value

if (key, value) in d.items():
	print("yes")
Posted by: Guest on November-16-2020

Code answers related to "check values in dictionary python with any"

Python Answers by Framework

Browse Popular Code Answers by Language