How to remove characters present in a substring and duplicate from string in Python

1 Answer

0 votes
s = 'python programming language'
chars = 'poa'
  
s = ''.join(list(set(s) - set(chars))) 

print(s)  

         
      
'''
run:
 
lmieytg rhnu
      
'''

 



answered Apr 24, 2020 by avibootz
...