Частый запрос среди новичков по версии AnswerThePublic. Дополним привычное представление об удалении дубликатов парой трюков.
Допустим, у нас есть список:
list_inp = [100, 75, 100, 20, 75, 12, 75, 25] set
set_res = set(list_inp) print("The unique elements of the input list using set():\n") list_res = (list(set_res))not in
for item in list_inp: if item not in res_list: res_list.append(item) numpy.unique
import numpy as npres = np.array(list_inp) unique_res = N.unique(res) #лучшиепрактики