This article example describes how python determines whether a specified key value exists or not via a dictionary dict. Shared for your reference. Specific as follows:
There are two ways to determine whether a specified key exists or not in python, one is through the has_key method of the dictionary object, and the other is through the in method, the following is a detailed example.
d={'site':'https://','name':'jb51','is_good':'yes'} # method 1: by has_key print d.has_key('site') #Method 2: Through in print 'body' in ()
I hope that what I have described in this article will help you in your Python programming.