我有一个要通过 processTestFile() 函数运行的文件名列表,该函数返回我要存储的结果字典:
# Count success or failure of test cases
counts = {
"success": 0,
"failure": 0
}
主流程循环如下所示:
for fileName in all_files(fileReferences["testCasesPath"],"*.txt") :
print "\n\nRunning test case file = ", fileName
myCounts = processTestFile(fileName)
我在想类似的东西:
myArray = {}
myArray[fileName] = myCounts
我会引用为:
for name in myArray
print name, myArray[name] ["success"], myArray[name] ["failure"]
我怀疑这段代码会起作用。你有什么建议?