I think this might be the best way to do it:
my_dict.get(key, value_if_absent)

Reply via email to