[Pythonmac-SIG] Calling diff from MacPython

David Goodger goodger@users.sourceforge.net
Fri, 13 Sep 2002 17:19:43 -0400


Robin Siebler wrote:
> I need to compare to files and find out where they are different.  Using diff
> seems to be a much better/faster choice compared to using cmp().

cmp() just tells you if they're identical; diff tells you *what* the
differences are.  So I'd say it's more useful anyhow.

> How would I call the *nix command diff from MacPython?

Why not use Python's difflib?  It may not be the speed demon that /bin/diff
is, but it's OS-independent and gives *very* readable results.

-- 
David Goodger  <goodger@users.sourceforge.net>  Open-source projects:
  - Python Docutils: http://docutils.sourceforge.net/
    (includes reStructuredText: http://docutils.sf.net/rst.html)
  - The Go Tools Project: http://gotools.sourceforge.net/