list = [1,4,2,3,4,5,6]
result = []
for i in list:
if i not in result:
result.append(i)
print(result)list = [1,4,2,3,4,5,6]
length = len(list)
for i in range(length):
if list[i] == list[i+1] and i+1 <= length:
list.remove(list[i])
print(list)
and i+1 <= lengthprint(list(set(source_list)))source_list = [1, 4, 2, 3, 4, 5, 6]
print(source_list)
print(list(set(source_list)))[1, 4, 2, 3, 4, 5, 6]
[1, 2, 3, 4, 5, 6]
Process finished with exit code 0 def build_unique_list_keep_order(seq):
seen = set()
seen_add = seen.add
return [x for x in seq if not (x in seen or seen_add(x))]