You read it one line at a time, but write only if the counter is between the numbers. And don't use "i", "l", or "o" as single variables because they look too much like numbers.
f = open(infile,'r')
o = open(outfile,'w')
ctr = 1
for line in f:
if first <= ctr <= last:
o.write(str(ctr)+'\t'+line)
ctr += 1
f.close()
o.close()
woooee
Nearly a Posting Maven
2,454 posts since Dec 2006
Reputation Points: 777
Solved Threads: 714