Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to find duplicate strings in a list of string python function

sam_list = [11, 13, 15, 16, 13, 15, 16, 11] 

print ("The list is: " + str(sam_list)) 

# to remove duplicates from list 

result = [] 

[result.append(x) for x in sam_list if x not in result] 

# printing list after removal 

print ("The list after removing duplicates: " + str(result))
Comment

PREVIOUS NEXT
Code Example
Python :: feature engineering data preprocessing 
Python :: python dict items 
Python :: Convert csv to dictionary in Python 
Python :: how to add axis labels to a plotly barchart 
Python :: how to get cpu model in python 
Python :: python match case 
Python :: check package is installed by conda or pip environment 
Python :: python if in list 
Python :: python strip() 
Python :: argparse type 
Python :: // in python 
Python :: fix the size of a deque python 
Python :: numpy argsort 
Python :: Encrypting a message in Python 
Python :: how to close opened file in python 
Python :: python table code 
Python :: python check empty string 
Python :: django make new application folder 
Python :: how to check if digit in int python 
Python :: python math packege power e 
Python :: aws lambda logging with python logging library 
Python :: full_like numpy 
Python :: roc curve 
Python :: check for null values in rows pyspark 
Python :: change the format of date in python 
Python :: list vs tuple 
Python :: python remove  
Python :: how to add elements in a list together python 
Python :: pandas drop columns 
Python :: immutability in python 
ADD CONTENT
Topic
Content
Source link
Name
4+8 =