from collections import namedtuple
Point = namedtuple("Point", ["x", "y"])
p = Point(1, 2)
print(p, p.x)
from collections import deque
lst = deque([1, 2, 3, 4, 5])
lst.append(6)
lst.appendleft(0)
lst.pop()
lst.popleft()
print(lst)
lst = [0, 1, 2, 3, 4]
lst.append(5)
lst.pop(0)
print(lst)
from collections import Counter
s = "1223334444555550000000000"
print(dict(Counter(s)))
from collections import Counter
s = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4]
print(Counter(s))
from collections import Counter
s = (1, 2, 2, 3, 3, 3, 4, 4, 4, 4)
print(Counter(s))
from collections import defaultdict
dic = defaultdict(list)
dic["k1"].append(1)
print(dic)
原文:https://www.cnblogs.com/Ylinn/p/13900245.html