Python Forum
delete identical entries in a list
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
delete identical entries in a list
#11
often, the only order i need can be accomplished at the end of usage as a set after i convert it to a list.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#12
However, numpy has a unique method which returns the unique elements from a list. Sorted
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#13
Quote:list1 = ['123','123','123','456', '456', '456', '789', '789', '789']

data = list(set(list1))
print data
Reply
#14
What is a 'hashable' object?
Reply
#15
Basically, a hashable object is one that implements the __hash__ method, which returns an integer. There are two requirements though: The same object must always return the same hash, and two objects that are equal must return the same hash. In Python, this typically means the objects are immutable. Note that to be an item in a set or a key in a dictionary the item must be hashable. Typical objects used in these cases are ints, floats, strings, and tuples. Lists, dictionaries, and sets are not hashable (although frozensets are).
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020