suppose I have a file.txt with line
aaaa = /bbb/ccc/ddd/eee/fff
I would like replace ccc with xxx
I have tried next without success
import re
import fileinput
for line in fileinput.input(file.txt, inplace=True):
re.sub(r'(ccc)', 'xxx', line)