Reading Time: 1 minutes
Removing duplicate items from lists in Python
A simple way to remove duplicate items from a list is to cast it to a set, and then back to a list using the constructors of builtin set and list classes.
>>> aList = [1, 2, 3, 1, 2, 3, 4, 5] >>> list( set(aList) ) [1, 2, 3, 4, 5]