Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

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
 
PREVIOUS NEXT
Tagged: #python #test #list #dicts #key
ADD COMMENT
Topic
Name
3+6 =