所需统计的列表: 1. 遍历 + 用字典存储 def get_counts(sequence): counts = { } for x in sequence: if x in counts: counts[x] +=