I've tried to write python code to do the following, and I'm stuck. Please help.
I have this file "names.txt"
rainbow like to play football however rainbow ... etc names = rainbow, john, alex rainbow sdlsdmclscmlsmcldsc.
I need to replace rainbow word to (Removed) in line which starts with "name = "
I need the code to search for keyword " name = " and replace the word "rainbow" to " (Removed") in the same line without changing the words rainbow in other lines, then overwrite the file "names.txt" with the changes to be like:
rainbow like to play football however rainbow ... etc names = (Removed), john, alex rainbow sdlsdmclscmlsmcldsc.
Thanks