I am having the following dict
a= {"b":"2", "c":"3","e":"5"}
and I am using if
statement to find the presence of keys in dict as follows
if ("c" or "s") in a:
print a['s']
I am getting error if the key s
is not available. But I have a['c']
My question is how can I get the value of the particular key in the print statement. i.e the print
statement should be independent of the keys in if
statement.