[Python] How to remove duplicate values from the list

Sample code

some_list = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5]

#Convert to set and then back to list
uniq_list = list(set(some_list))

print(uniq_list)
# => [1, 2, 3, 4, 5]

reference

-Delete / extract duplicate elements from list (array) with Python \ | note \ .nkmk \ .me

Recommended Posts

[Python] How to remove duplicate values from the list
How to remove duplicate elements in Python3 list
[Python] How to output the list values in order
How to remove duplicates from a Python list while preserving order.
[Algorithm x Python] How to use the list
[Python] How to use list 1
How to get the Python version
[Python] How to import the library
[Python] How to use list 3 Added
[Python] How to swap array values
How to access wikipedia from python
How to get the last (last) value in a list in Python
Extract the value closest to a value from a Python list element
[Python] How to convert a 2D list to a 1D list
How to update Google Sheets from Python
How to get followers and followers from python using the Mastodon API
[Python] How to get & change rows / columns / values from a table.
How to access RDS from Lambda (python)
How to operate Linux from the console
Python amateurs try to summarize the list ①
How to access the Datastore from the outside
Summary of how to use Python list
Remove and retrieve arrays from fasta according to the ID list file
[Introduction to Python] How to sort the contents of a list efficiently with list sort
How to pass values to JavaScript variables directly from the [Django] template tag
How to assign multiple values to the Matplotlib colorbar
[python] How to display list elements side by side
How to use the C library in Python
How to open a web browser from python
How to clear tuples in a list (Python)
[Python] How to change the date format (display format)
Study from Python Hour7: How to use classes
[Python] How to read data from CIFAR-10 and CIFAR-100
How to generate a Python object from JSON
How to operate Linux from the outside Procedure
How to handle Linux commands well from Python
How to erase the characters output by Python
How to measure line speed from the terminal
How to get the files in the [Python] folder
A python amateur tries to summarize the list ②
How to install Python
Changes from Python 3.0 to Python 3.5
Changes from Python 2 to Python 3.0
How to install python
How to use list []
[Python Tips] How to retrieve multiple keys with the maximum value from the dictionary
How to get a list of files in the same directory with python
How to create an article from the command line
How to retrieve the nth largest value in Python
The wall of changing the Django service from Python 2.7 to Python 3
How to get the variable name itself in python
Think about how to program Python on the iPad
How to get the number of digits in Python
How to scrape image data from flickr with python
[Introduction to Python] How to iterate with the range function?
How to know the current directory in Python in Blender
[Reintroduction to python] How to import via the parent directory
How to use the Raspberry Pi relay module Python
[Python] How to specify the download location with youtube-dl
How to write a list / dictionary type of Python3
I wanted to use the Python library from MATLAB