I do the following for replacing.
import fileinput
for line in fileinput.FileInput("input.txt",inplace=1):
line = line.replace("A","A'")
print line,
But I want to do it many replaces.
Replace A with A' , B with BB, C with CX, D with KK, etc.
I can of course do this by repeating the above code many times.
But I guess that will consume a lot of time especially when input.txt is large.
How can I do this elegantly?
Emphasis added
My input is not just a str ABCD.
I need to use input.txt as input and I want to replace every occurrences of A in input.txt to A', every occurrences in input.txt of B to BB, every occurrences of C in input.txt to CX, every occurrences of D in input.txt to KK.