how to add to a dictionary value or create if not exists
I want to add to a value in a dictionary storing counters:
d[key] += 1
but sometimes the key will not exist yet. Checking to see if the key exists seems too ugly. Is there a nice and pythonic one liner for this - add if the key exists, or create the value 1 if the key is not in the dict.keys ?