Search and replace from a text file as input in another text file
Blockquote #!/usr/bin/env python3 import fileinput with fileinput.FileInput(preprocess.rul, inplace=True, backup=‘.bak’) as file: for line in file: print(line.replace(text_to_search, replacement_text), end=‘’) Blockquote. Any help given to set this script working would be greatly appreciated.