Use set()
to remove duplicates if all values are hashable:
>>> your_list = ['one', 'two', 'one']
>>> len(your_list) != len(set(your_list))
True
More Related Contents:
- What does += mean in this context?
- User input integer list [duplicate]
- How do you remove duplicates from a list whilst preserving order?
- Converting a string representation of a list into an actual list object [duplicate]
- Loop “Forgets” to Remove Some Items [duplicate]
- Find and replace string values in list
- How do I remove duplicates from a list, while preserving order?
- How can I remove duplicate words in a string with Python?
- TypeError: unhashable type: ‘list’ when using built-in set function
- Confused about __str__ on list in Python [duplicate]
- How do I convert a list into a string with spaces in Python?
- Perform a string operation for every element in a Python list
- How do I serialize a Python dictionary into a string, and then back to a dictionary?
- Remove duplicates and original from list
- How to convert a string of space- and comma- separated numbers into a list of int? [duplicate]
- Change a string of integers separated by spaces to a list of int
- How can I find same values in a list and group together a new list?
- How to convert a string list into an integer in python [duplicate]
- Convert list of strings to dictionary
- Sort list of strings by a part of the string
- How to create a list with the characters of a string? [duplicate]
- Python: How to check a string for substrings from a list? [duplicate]
- Convert a columns of string to list in pandas
- How to apply __str__ function when printing a list of objects in Python [duplicate]
- Python: Remove Duplicate Items from Nested list
- Python: Rename duplicates in list with progressive numbers without sorting list
- How does str.startswith really work?
- How does str(list) work?
- Concatenate elements of a tuple in a list in python [duplicate]
- Length of longest word in a list