finding and listing the differences between two files

Lyle Johnson ljohnson at resgen.com
Wed Mar 7 09:27:16 EST 2001


Chris,

Unless there's more to this story, I think your best bet is to use what's
already working (diff). You can of course suck in the results by opening a
pipe in Python, e.g.

    import os

    results = os.popen("diff file1 file2")

See the standard documentation on the "os" module and pipes for more
details. Now, keep in mind that this won't necessarily work if you move your
Python script to an operating system that doesn't have "diff" available at
the command line (say, Windows).

Lyle





More information about the Python-list mailing list