total = len(v) # 总共的请求数 counts = map(sum, zip(*v)) # 各请求的个数 print counts suc, suc_rate = counts[0], counts[0] * 1.0 / total link_full, link_full_rate = counts[1], counts[1] * 1.0 / total tmp = [ type_name, total, str(suc) + " (%.2f%%)" % (suc_rate * 100), str(link_full) + " (%.2f%%)" % (link_full_rate * 100) ] if type_name == 'csv012': tmp += [ str(counts[4]) + "/" + str(counts[2]) + " (%.2f%%)" % (counts[4] * 100.0 / counts[2]), str(counts[5]) + "/" + str(counts[3]) + " (%.2f%%)" % (counts[5] * 100.0 / counts[3]) ] tmp[0] = 'csv012(交通数据验证)' elif type_name == 'csv011': tmp[4:] = ["null"] * 2 tmp[0] = 'csv011(交通库中数据)' elif type_name == 'csv010': tmp[3:] = ["null"] * 3 tmp[0] = 'csv011(酒店库中数据)' msg.add_row(tmp) print '\n' print msg email.addContent(msg.get_string()) email.launch()