set 数据类型 set 与列表类似,区别在于 set 不能包含重复的值. In [1]: a_list = ['a', 'b', 'c', 'b', 'd', 'm', 'n', 'n'] In [2]: b = set(a_list) In [3]: b Out[3]: {'a', 'b', 'c', 'd', 'm', 'n'} In [4]: type(b) Out[4]: set set 获取重复的元素 In [7]: a_list = ['a', 'b', 'c', 'b', 'd'…