哈希工具主方法
来源:互联网 发布:win10网络连接本地连接 编辑:程序博客网 时间:2024/05/18 01:40
#!/usr/bin/env python
# encoding: utf-8
"""
tool.py
create at 12-9-5 by Administrator
"""
import os
import hashlib
import json
def main(assets_dir, target_dir):
"""
哈希工具主方法
"""
resource_config = {}
for root, dirs, files in os.walk(assets_dir):
if root.find('.svn') == -1:
for file in files:
name, ext = os.path.splitext(file)
file_name = '%s/%s' % (root, file)·
fr = open(file_name, 'rb')
context = fr.read()
hash_name = hashlib.md5(context + file_name).hexdigest()
if not os.path.exists(target_dir):
os.makedirs(target_dir)
fw = open('%s/%s%s' % (target_dir, hash_name, ext), 'wb')
fw.write(context)
resource_config[file_name] = '%s/%s%s' % (target_dir, hash_name, ext)
fr.close()
fw.close()
f = open('resource_config.json', 'w')
f.write(json.dumps(resource_config))
f.close()
if __name__ == '__main__':
main('assets', 'target_folder')
- 哈希工具主方法
- 工具方法
- 工具方法
- 工具+方法
- 一个工具类方法
- 软件工程开发方法,工具
- 软件工程开发方法,工具
- QC工具与方法
- 方法是一种工具?!
- 。工具问题解决方法。
- iPhone开发工具方法
- Android开发工具方法
- JAVA工具方法摘抄
- ajax工具方法
- webservice工具方法
- js 工具方法
- 工具方法集合
- 分析工具、方法
- svn代码回滚命令
- C++->json
- 11 个惊人的 CSS3 和 jQuery 制作的教程收集 .
- 用按钮实现链接
- 15个值得开发人员关注的jQuery开发技巧和心得
- 哈希工具主方法
- Vc控件用法总结之List Control
- feature.conf applicationmap中的caller和callee分别是什么意思
- JavaScript通过Flash的CallFunction和Flash通信
- Page.RegisterStartupScript及 不执行的原因
- 串口的打开与关闭的jni层代码
- minimalcomps progressBar
- CDC与HDC的区别以及他们之间的转换
- 职涯7阶段_第2阶:适应期_立住脚VS走弯路