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

1 Answer

0 votes
s = 'python programming language'
chars = 'poa'
  
l = [] 
for ch in s: 
    if ch not in chars: 
        l.append(ch) 
s = ''.join(l) 

print(s)  

         
      
'''
run:
 
ythn rgrmming lnguge
      
'''

 



answered Apr 24, 2020 by avibootz
...