import reexp = "1+2+N3"variable_refs = re.compile(r"(?<!N)([0-9]+)")exp_template = re.sub(variable_refs, r'{key_\1}', exp)print(exp_template)
Standard input is empty
{key_1}+{key_2}+N3
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!