Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to find common characters in two strings in python

#find common elements present in 2 strings
str1 = 'abcdef'
str2 = 'abcdf'
com_str = ''.join(set(s1).intersection(s2))
print(com_str)
 
PREVIOUS NEXT
Tagged: #find #common #characters #strings #python
ADD COMMENT
Topic
Name
4+1 =