浙江省高等学校教师教育理论培训

微信搜索“毛凌志岗前心得”小程序

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

#!/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

posted on 2012-04-08 16:40  lexus  阅读(295)  评论(0)    收藏  举报