I have a file as follows:
line 1: _____
...
# for AAA
#export CONFIG = AAA_defconfig
# for BBB, BbB, Bbb, BBb3
#export CONFIG = BBB_defconfig
# for CCC, CcC, Ccc, Ccc1
#export CONFIG = CCC_defconfig
...
other lines
I want manipulate the file, so that based on the given string, I could export the right “CONFIG”, and comment the others.
e.g. if I got “CcC”, then the file would be manipulated as
line 1: _____
...
# for AAA
#export CONFIG = AAA_defconfig
# for BBB, BbB, Bbb, BBb3
#export CONFIG = BBB_defconfig
# for CCC, CcC, Ccc, Ccc1
export CONFIG = CCC_defconfig
...
other lines
what the good way to do it in python?
Thanks in advance!!
Then why not make it as
unless this is not a python file and you want to manipulate it. It looks like that.
In that case create a config generator which will create a config file based on the line variable.
[Edit: Based on comments]
You might have to make some adjustments but this should work.
Input: file1
Output: file2