The python built in function 'set()' helps to remove the duplicates from a list.
consider an example:
consider an example:
>>> list1 = [1, 2, 3, 1, 2, 5, 6, 7, 8]
>>> list1
[1, 2, 3, 1, 2, 5, 6, 7, 8]
>>> set(list1)
set([1, 2, 3, 5, 6, 7, 8])
>>> list(set(list1))
[1, 2, 3, 5, 6, 7, 8]
>>>
Labels: duplicates, list, python
0 comments: Post Yours! Read Comment Policy ▼
PLEASE NOTE:
We have Zero Tolerance to Spam. Chessy Comments and Comments with Links will be deleted immediately upon our review.