import re text = re.sub(r'(get)', r'1@', text)
>>> import re >>> text = 'Do you get it yet?' >>> re.sub(r'(get)', r'1@', text) 'Do you get@ it yet?'