I have some strings in python, like:
1) 'a_1_2+c_2_4 + 5'
2) 'ctl_1_3/80'
3) 'd_10_55'
...
I want to replace them with re. They should look like:
1) 'p.get("a_1_2", 0)+p.get("c_2_4", 0) + 5'
2) 'p.get("ctl_1_3", 0)/80'
3) 'p.get("d_10_55", 0)'
Can you help me with regular expression?
P.S. p is simple dict in python
It’s unclear what rules govern the second argument to
p.get(). It is present in the first example but not the other two.