deduplicate¶
- deduplicate(items: Iterable) list[source]¶
Remove duplicate entries from a list, but preserve the order.
Note that the use of list(set(x)) can cause random order in the output. The return of this function is guaranteed to be in the order that unique items show up in the input, unlike a deduplicate-resorting solution like sorted(set(x). Ref: https://stackoverflow.com/questions/480214/how-do-i-remove-duplicates-from-a-list-while-preserving-order This solution only works for Python 3.7+.