How to remove specific character N times from a string in Python

1 Answer

0 votes
s ='python c++ java programming aa'

N = 2
ch = 'a'
s = s.replace(ch, '', N)

print(s)


'''
run:

python c++ jv programming aa

'''

 



answered Jan 16, 2020 by avibootz

Related questions

...