How to filter specific characters out from a string in Python

1 Answer

0 votes
s = 'python java php c c++ c# vb.net'
	
s = ''.join((filter(lambda ch: ch not in ['p', 'a', 'b'], s)))
 
print(s)



'''
run:

ython jv h c c++ c# v.net

'''

 



answered Feb 2, 2020 by avibootz
...