How does collections.defaultdict work?

前端 未结 15 2196
离开以前
离开以前 2020-11-22 12:50

I\'ve read the examples in python docs, but still can\'t figure out what this method means. Can somebody help? Here are two examples from the python docs

>         


        
15条回答
  •  孤独总比滥情好
    2020-11-22 13:04

    In short:

    defaultdict(int) - the argument int indicates that the values will be int type.

    defaultdict(list) - the argument list indicates that the values will be list type.

提交回复
热议问题