How to remove all appearance of specific character from a string in Python

2 Answers

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

s = s.replace('a', '')

print(s)


'''
run:

python c++ jv progrmming

'''

 



answered Jan 16, 2020 by avibootz
0 votes
s ='python c++ java programming'

s = s.translate({ord('a'): None})

print(s)


'''
run:

python c++ jv progrmming

'''

 



answered Jan 16, 2020 by avibootz
...