Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

check if a given key already exists in a dictionary

message = "blah" if 'key1' in my_dict else "booh"
print(message)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #check #key #exists #dictionary
ADD COMMENT
Topic
Name
1+7 =