Any way to adjust difflib algorithm?

Chris Rebert clp2 at rebertia.com
Fri Aug 14 14:56:58 EDT 2009


On Fri, Aug 14, 2009 at 2:38 PM, Grant Edwards<invalid at invalid> wrote:
> I'm trying to use difflib to compare two files, and it's not
> producing very useful results.  When comparing two lines where
> only a few characters have changed, it usually seems to decide
> that a line was deleted/inserted/replaced rather than changed.
<snip>
> Is there a way to tell the differ to try harder to match lines?

You could use a wordwise diff instead: http://www.gnu.org/software/wdiff/
Obviously that's not a pure Python solution though.

Cheers,
Chris
-- 
http://blog.rebertia.com



More information about the Python-list mailing list