#方法一 利用异常处理 nums = [1, 2, 3, 1, 4, 2, 1, 3, 7, 3, 3] Time = {} for num in nums: try: Time[num] += 1 except: Time[num] = 1 Max = max(Time.values()) for key, value in Time.items(): if value == Max: print(key) #方法二 合理利用 not in nums = [1, 2, 3, 1, 4, 2, 1, 3, 7, 3, 3] Time = {} for num in nums: if num not in Time: Time[num] = nums.count(num) Max = max(Time.values()) for key, value in Time.items(): if value == Max: print(key)