时间:2021-07-01 10:21:17 帮助过:124人阅读
假设有2个二进制文件(0.bin, 1.bin),用checksum检验内容是否相同
# coding: utf8 # Python2.6.2 import md5 with open('0.bin', 'rb') as f: s = md5.new(f.read()).hexdigest() with open('1.bin', 'rb') as f: ss = md5.new(f.read()).hexdigest() print repr(s), len(s) print repr(ss), len(ss)
希望本文所述对大家的Python程序设计有所帮助。