fork download
  1. import re
  2.  
  3.  
  4. r = re.compile(r'hello|world')
  5.  
  6.  
  7. string = 'hello world the World!!'
  8.  
  9.  
  10. x = r.findall(string)
  11. for x in x:
  12. string = string.replace(x, 'self.' + x)
  13.  
  14. print(string)
  15.  
Success #stdin #stdout 0.02s 8736KB
stdin
Standard input is empty
stdout
self.hello self.world the World!!