Given string = "a(a123-bcd-a456)ppll"
Goal: replace the "a" that are within the bracket with "A"
Desire output = "a(A123-bcd-A456)ppll"
I have tried:
regex = '\(.*?\)' re.sub(regex, string, string.replace("a", "A")) but it results in Aa(a123-bcd-a456)ppllppll?
没有评论:
发表评论