Monday 17 February 2020

Python dictionary increment

An alternative is:
my_dict[key] = my_dict.get(key, 0) + num

from : https://stackoverflow.com/questions/12992165/python-dictionary-increment

No comments:

Post a Comment