I need some help figuring out what the problem on this. It actually a simple program that just read lines that has comment of #, if it does it delete that line and moves on. But for some reason it not working very well.
Thanks.
Code:
#!/bin/python
input = open('/boot/config', 'r')
output = open('/tmp/config', 'w')
lines = input.readlines()
number = 0
for line in lines:
if line[0] == "#":
del lines[number]
else: number += 1
for y in range(len(lines)):
output.writelines('%s' % lines[y])
output.close()
Comment