nametuple () tuple named
from collections import namedtuple as nt
Panda = nt('Panda_class',['age','name'])
r = Panda(18,'pann')
print(r.age)
print(r.name)
defaultdict () defaults dictionary
from collections import defaultdict
def dicf():
return 'hello'
d = defaultdict(dicf,name='Andy',age=10)
print(d['he']) #hello
print(d)
Counter () counter
from collections import Counter
#Counter 计数器
c = Counter([1,2,3,4,5,6,7,8,9,2])
print(c.most_common(1)) #统计出现最多的前几名
#[(2, 2)]