Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

check if dict key exists python

d = {"key1": 10, "key2": 23}

if "key1" in d:
    print("this will execute")

if "nonexistent key" in d:
    print("this will not")
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #check #dict #key #exists #python
ADD COMMENT
Topic
Name
8+6 =