import restr = 'This is number 1 and this is number 22'pat = r'\d+'repl = r'"\g<0>"'print(re.sub(pat, repl, str))
Standard input is empty
This is number "1" and this is number "22"
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!