Home

Get The Diff Between Two Files In Python

This is what I ended up with for real

The below are for notes to put together later

NOTE: the filecmp.cmp has problems with newlines in some cases that I can't figure out (like it looks like there shouldn't be a difference but there is)

I think this is the way I'm going to do it for testing (time passes... nope, gonna use difflib below since it's easier to see what's up). TODO: Figure out if there's a way to use the diff itself for the compare instead of filecmp.

This is the way that I like to do it that's very compact.

Here's the other examples:

TODO: Go thru here are write up more examples:

https://docs.python.org/3/library/difflib.html#module-difflib

See also this which looks interesting, but not that the `io.open` isn't closed (see comment on that)