Saludos a todos,Python pregunta re.sub
no estoy seguro si esto es posible, pero me gustaría utilizar grupos emparejados en un cambio de expresiones regulares para llamar variables.
a = 'foo'
b = 'bar'
text = 'find a replacement for me [[:a:]] and [[:b:]]'
desired_output = 'find a replacement for me foo and bar'
re.sub('\[\[:(.+):\]\]',group(1),text) #is not valid
re.sub('\[\[:(.+):\]\]','\1',text) #replaces the value with 'a' or 'b', not var value
thoughts?
ha! realmente no. familiar con py, perl y php - master de none. gracias por su ayuda :) – netricate