On Mar 19, 11:55 am, Shane Geiger <[EMAIL PROTECTED]> wrote:
> In the unix world, 'fc' would be like diff.
>
> """
> Python example of checksumming files with the MD5 module.
>
> In Python 2.5, the hashlib module would be preferable/more elegant.
> """
>
> import md5
>
> import string, os
> r = lam
In the unix world, 'fc' would be like diff.
"""
Python example of checksumming files with the MD5 module.
In Python 2.5, the hashlib module would be preferable/more elegant.
"""
import md5
import string, os
r = lambda f: open(f, "r").read()
def readfile(f,strip=False): return (strip and stripp
In <[EMAIL PROTECTED]>, Beliavsky
wrote:
> […] How should one check that files are the same in Python? The files
> are plain text.
Take a look at the `filecmp` module. Pay attention to the shallow
argument of `filecmp.cmp()` and the default value!
Ciao,
Marc 'BlackJack' Rintsch
--
htt
A crude way to check if two files are the same on Windows is to look
at the output of the "fc" function of cmd.exe, for example
def files_same(f1,f2):
cmnd= "fc " + f1 + " " + f2
return ("no differences" in popen(cmnd).read())
This is needlessly slow, because one can stop comparing tw