You should first test that what you want is there.
for cell in row:
tmp = ('%VAR_' + headerRow[i] + '%')
if tmp in line:
line = line.replace(tmp, cell) # string.replace(old, new)
print "replaced line =", line
else:
print tmp, "not found"
woooee
Posting Maven
2,707 posts since Dec 2006
Reputation Points: 827
Solved Threads: 780
Skill Endorsements: 9
Note that you will replace tmp with cell no matter when it is found, i.e the for loop will always replace tmp with cell 1 on the first pass if it is found, no matter where in the line it occurs. Without more info about what input and output should be, and what row contains, there is nothing more that can be said.
woooee
Posting Maven
2,707 posts since Dec 2006
Reputation Points: 827
Solved Threads: 780
Skill Endorsements: 9