import hashlib
def get_md5(file): md5 = hashlib.md5() with open(file, 'rb') as f: content = f.read() md5.update(content) ret = md5.hexdigest() return ret