How to remove duplicates in a list in python
You can use the built-in function set() to create a set from your list. Then you can use the.remove() method on this set to delete any duplicate elements:

list = [1, 2, 3, 4, 5, 6, 7, 8, 9]
set(list) # creates a set containing all elements of the list
print(list) # prints [1, 2, 3, 4, 5, 6, 7, 8, 9]
list.remove(7) # removes element 7 from the list, leaving [1, 2, 3, 4, 5, 6, 8]
print(list) # prints [1, 2, 3, 4, 5, 6, 8]


Note that removing an item from a list changes the list itself, so be sure to copy the list before removing items if you need to keep it unchanged.