a = [1, 2, 3, 2, 3, 3] dict1 = {} for i in a: dict1[i] = dict1.get(i, 0) + 1 print(dict1)
京公网安备 11010502049817号