我正在寻找这部分代码的不错选择:
def reportResult (finalParsResult):
print "Total Number of Mimatch Files:",
diffSum=0
for (gP, matchFiles, diffFiles, matchFolders, gpExtrFld, upExtraFldrs) in FinalResult:
diffSum=diffSum+len(diffFiles)
print "Number of diff files", diffSum
有什么建议吗?
答案 0 :(得分:1)
def reportResult(finalParsResult):
return sum(len(result_row[2]) for result_row in FinalResult)
或者,如果FinalResult
实际上应该是参数finalParsResult
:
def reportResult(finalParsResult):
return sum(len(result_row[2]) for result_row in finalParsResult)