Skip to content
Advertisement

Tag: unique

How do I remove duplicates from a list, while preserving order?

How do I remove duplicates from a list, while preserving order? Using a set to remove duplicates destroys the original order. Is there a built-in or a Pythonic idiom? Related question: In Python, what is the fastest algorithm for removing duplicates from a list so that all elements are unique while preserving order? Answer Here you have some alternatives: http://www.peterbe.com/plog/uniqifiers-benchmark

Advertisement