Did I find the right examples for you? yes no

All Samples(3)  |  Call(2)  |  Derive(0)  |  Import(1)
Compute the MD5 sum of a given file.

        def md5_file(fname):
    """
    Compute the MD5 sum of a given file.
    """
    m = hashlib.md5()
    file = open(fname)
    for line in file.readlines():
        m.update(line)
    file.close()
    return m.digest()
        


src/d/b/dblatex-0.3.4/lib/dbtexmf/dblatex/grubber/index.py   dblatex(Download)
from msg import _, msg
from plugins import TexModule
from util import md5_file
 
class Index(TexModule):
 
        if os.path.exists(self.source):
            self.md5 = md5_file(self.source)
        else:
            self.md5 = None
            msg.log(_("the index file %s is empty") % self.source, pkg="index")
            return 0
        new = md5_file(self.source)
        if not os.path.exists(self.target):
            self.md5 = new