Jul-10-2017, 08:39 PM
(Jul-10-2017, 07:10 PM)greektranslator Wrote: I use the code below through Notepad++ but I cannot make it match whole wordsThis works for me
with open('C:/Temp/Substitutions.txt') as f: for l in f: s = l.split() editor.replace(s[0], s[1])I also tried:
editor.pyreplace(r'\b' + s[0] + r'\b', s[1])and
editor = re.sub(r'\b' + s[0] + r'\b', s[1], editor)
Output:>>> re.sub(r'\b'+'CD'+r'\b','XX','ABCD CD CDAB ABCDEF CD')
'ABCD XX CDAB ABCDEF XX'
So I would suspect that the contents of s[0]
aren't what you think they are (you don't even trim()
the input lines)
Unless noted otherwise, code in my posts should be understood as "coding suggestions", and its use may require more neurones than the two necessary for Ctrl-C/Ctrl-V.
Your one-stop place for all your GIMP needs: gimp-forum.net
Your one-stop place for all your GIMP needs: gimp-forum.net