How to replace all numbers in a string with specific character in Python

1 Answer

0 votes
import re

s = "234Python 579programm89ing la90nguage100"

s = re.sub('[0-9]', 'W', s)

print(s)



'''
run:

WWWPython WWWprogrammWWing laWWnguageWWW

'''

 



answered Apr 15, 2021 by avibootz
...