#!/usr/bin/env python
#encoding=utf-8
import hashlib,md5
print md5.new(file("/home/mlzboy/pycurl/examples/left_dat/doc_001.dat").read()).hexdigest()
f=open("/home/mlzboy/pycurl/examples/left_dat/doc_001.dat","rb").read()
#f=f.decode("gb18030","ignore")
#print f.encode("utf-8")
m=hashlib.md5()
m.update(f)
#print m.digest()
print m.hexdigest()
the result is the same as md5sum utility
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)