how to check key exist in dictionary in python?

if key in dict:
     print "key:", key, " exist in dict"

value= d.get("key", 0)

No comments:

Post a Comment