Can replacement text in re.sub retrieve values from a dictionary?
In the same spirit as another SO's post, with the code
coord_re = re.sub(r"(\d), (\d)", r"\1,\2", coords)
I want to use backreferences in a replacement string as well, except that I want to use string that was referred as \1,\2 as a key to obtain value from some dictionary
For example, I want something similar to this:
d = {...somedict}
coord_re = re.sub(r"(\d), (\d)", d[value of \1]+','+d[value of \2], coords)