On Feb 20, 5:38 am, Peter Otten <[email protected]> wrote: > Yes you can get portions of the line by slicing: > > for line in open("infile"): > if line[8:18] != line[18:28]: > print line,
You can also name the slices, which makes the code more clear (IMO):
endda = slice(8,18)
begda = slice(18,28)
for line in open("infile"):
if line[endda] != line[begda]:
print line,
> Or you can use the struct module:
But this is the approach I'd take.
--
http://mail.python.org/mailman/listinfo/python-list
