arr = [(line.rstrip('\n').split(';')) for line in open('C:/Config_Changer.csv')]
import sys
import fileinput
for i, line in enumerate(fileinput.input('C:/1.cfg', inplace = 1)):
sys.stdout.write(line.replace(arr[0][0], arr[0][1]))
Hey all,
I wrote the above lines so it’s working fine but its replacing only ary[0][0], so i want to loop it as like below,so first dimention is needed to loop.Can anyone help me with the loop commands.Where should I have to put loop exactly ???
sys.stdout.write(line.replace(arr[a][0], arr[a][1]))
so what you want is to apply all the replacements that are in
arrto theline: (unlike aix’s answer, this one avoids the explicit indexing)