Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

check if value is in a dict keys

>>> person = {'name': 'Rose', 'age': 33}

>>> 'name' in person.keys()
# True

>>> 'height' in person.keys()
# False

>>> 'skin' in person # You can omit keys()
# False
Source by www.pythoncheatsheet.org #
 
PREVIOUS NEXT
Tagged: #check #dict #keys
ADD COMMENT
Topic
Name
9+4 =