Nested loop

Micah Elliott mde at micah.elliott.name
Wed Nov 30 20:31:18 CET 2005


> Micah Elliott wrote:
> > On Nov 29, viewcharts wrote:
> >>I am reading two text files comparing the values in one to the other, 
> >>this requires two loops.
> > 
> > Or you could have a look at difflib.
> > http://docs.python.org/lib/differ-examples.html

On Nov 30, Steve Holden wrote:
> Indeed, but I personally don't see a way to persuade difflib to
> compare the lines of one file with the fourth field of lines in
> another.

Right.  I was just pointing out the possibility (I don't know the
OP's data format) since no one had mentioned it yet.  If there are
multiple "fields" per line, then pre-massaging into one field per line
might be a reasonable approach.  But then you might end up doing more
work than the nested loop idea.

-- 
_ _     ___
|V|icah |- lliott             <><             mde at micah.elliott.name
" "     """



More information about the Python-list mailing list