Jan-30-2023, 04:38 PM
(This post was last modified: Jan-30-2023, 04:38 PM by deanhystad.)
I would try re.sub. You might be able to do it with just one command, but "1 Sam" may cayse problems. This could also be done using str.replace(), but matching only complete words might be difficult.
Either way I would treat the file like one long string instead of a line at a time.
Either way I would treat the file like one long string instead of a line at a time.