I want to insert a key-value pair into dict if key not in dict.keys(). Basically I could do it with: if key not in d.keys(): d[key] = value But is there a better way? Or what's the pythonic solution to this problem? Continue reading...