3 ms·
You can also say a_dict.setdefault(key, default) which is like a_dict.get(key, default) but will also do a_dict[key]=default if there does not already exist a v
by koenigdavidmj 17y ago
You can also say a_dict.setdefault(key, default) which is like a_dict.get(key, default) but will also do a_dict[key]=default if there does not already exist a value for key.