I have a dictionary and I would like to get some values from it based on some keys. For example, I have a dictionary for users with their first name, last name, username, ad
You can use myDict.has_key(keyname) as well to validate if the key exists.
myDict.has_key(keyname)
This would work only on versions lower than 3.1. has_key has been removed from Python 3.1. You should use the in operator if you are using Python 3.1
has_key
in