#!/usr/bin/env python #-*- coding:utf-8 -*- ''' 计算某个目录下所有文件的MD5值 ''' import os import sys import hashlib def md5sum(path): for i in os.listdir(path): md5 = hashlib.md5() files = os.path.join(path, i) if os.path.isfile(files): with open(files) as fd:…
计算 byte[] 转 int modebus 指定位数 获取值 使用 if (bytetores.Length > 6) { int total = 0; for (int i = 0; i < bytetores[3]; ++i) { total += bytetores[i + 3] * (256 ^ (bytetores[3] - i - 1)); } }…
getsizeof的局限 python非内置数据类型的对象无法用sys.getsizeof()获得真实的大小,例: import networkx as nx import sys G = nx.Graph() l = [i for i in xrange(10000)] print "size of l:", sys.getsizeof(l) G.add_nodes_from(l) print "size of graph:", sys.getsizeof(G)…