Shakerato

initialize the empty list in the dictionary' in Python 본문

Research

initialize the empty list in the dictionary' in Python

Shakeratto 2020. 9. 5. 18:57

from collections import defaultdict

 

list_in_dict = defaultdict(list)

 

list_in_dict['A'].append(0)

list_in_dict['A'].append(1)

list_in_dict['B'].append(2)

Comments