I have to read through a text file and replace all occurences of
%%CNT1%%
with the value of a counter.
The part of my code that does the actuall replacements looks like this:
for i in range(1, (count1 + 1)):
out.writelines(re.sub("%%CNT1%%", str(i), text))
This works fine. Now what I need to do is to still replace all te occurences of %%CNT1%%, but there are places where it looks like this: A%%CNT1%%. My code does not replace %%CNT1%% with the ount value if there is an A in front of it (eg A%%CNT1%%)
Is there any way for me to fix this?