Aug-28-2019, 05:15 AM
Hi,
I have a small text, just 12 lines. Each line has a word or phrase I want to remove and replace with a dropdownbox containing 10 words. I read the file in with .readlines() then check each line in a loop.
One word is ate.
The first line contains the word late. My program also removes the ate from late. That is not what I want.
Is there a simple way to prevent this? How to remove only an exact match?
I could .split() the line, but that would make it harder to remove phrases. Works great for single words!
I have a small text, just 12 lines. Each line has a word or phrase I want to remove and replace with a dropdownbox containing 10 words. I read the file in with .readlines() then check each line in a loop.
One word is ate.
The first line contains the word late. My program also removes the ate from late. That is not what I want.
Is there a simple way to prevent this? How to remove only an exact match?
I could .split() the line, but that would make it harder to remove phrases. Works great for single words!