I'm trying to write a python script that will search and replace specific string in text file
As an example foo.txt is like that:
[section1]
option1=xyz
option2=abc
[section2]
option1=aaa
option2=bbb
My objective is to replace only option1 and option2 values under section2 without changing anything in section1 as the following be:
[section1]
option1=xyz
option2=abc
[section2]
option1=xxx
option2=zzz
I have tried pysed and many other methods with no dice. Any help from Python Guru ?
re