How to replace all numbers in a string with specific character and get the total numbers in Python

1 Answer

0 votes
import re

s = "234Python 579programm89ing la90nguage100"

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

print(s)
print(n)



'''
run:

WWWPython WWWprogrammWWing laWWnguageWWW
13

'''

 



answered Apr 15, 2021 by avibootz
...