Any way to adjust difflib algorithm?

Grant Edwards invalid at invalid
Wed Aug 19 22:16:22 CEST 2009

On 2009-08-19, Aahz <aahz at> wrote:
> In article <FMqdncOMnPg-JRjXnZ2dnUVZ_tti4p2d at posted.visi>,
> Grant Edwards  <invalid at invalid> wrote:
>>On 2009-08-14, Grant Edwards <invalid at invalid> wrote:
>>> In my particular usage, no lines have ever been
>>> inserted/deleted, so perhaps I should be running diffs on
>>> individual lines instead?  If I do that, I can't figure out
>>> how to generate HTML output.
>>I ended up using the SequenceMatcher on individual pairs of
>>lines and generating my own HTML based on the results of
>>That produced the desired results.
> Good work!  Note that IME most diff software shows changed
> lines as a delete-and-add.  For example, diff -u

Right -- though difflib did show _some_ lines as changed rather
than deleted/added, it wasn't obvious how it decided between
the two.  I suspect it used some sort of percentage-changed

For this application both files had all the same lines (by
definition), so what I was interested in was what parts of each
line changed.

Grant Edwards                   grante             Yow! I just heard the
                                  at               SEVENTIES were over!!  And
                                 I was just getting in touch
                                                   with my LEISURE SUIT!!

More information about the Python-list mailing list