Deltas with difflib?

Tim Peters tim.one at home.com
Wed Jan 2 21:51:20 EST 2002


[Magnus Lie Hetland]
> Is it possible (in any easy way) to use difflib to create deltas
> (which don't include the entire contents of both the compared
> files/texts)?

Read the docs for difflib's SequenceMatcher class, in particular the
get_opcodes() method.  This gives you a compact accounting of how to turn
one sequence into the other.  If you don't care about matching blocks,
ignore the "equal" tuples; etc.





More information about the Python-list mailing list