1
我有一個應用程序在最後創建csv文件以保存結果。我想我的應用程序,在每個應用程序run.My產生不同的CSV文件生成報告如下在每次運行時創建csv文件
def writeToCSVFile(self,csvFilePath,testResultList):
#Open a CSV file object
reportname = "toxedo_report0.csv"
csvFilObj=open(csvFilePath+reportname,"wb")
#writing CSV file with the statistical values
mywritter=csv.writer(csvFilObj)
for rowVal in testResultList:
mywritter.writerows(rowVal)
#Closing the CSV file object
csvFilObj.close()
testResultList是一個類型列表。有沒有辦法避免硬編碼報告名稱?我想知道如何在每次運行中創建不同的報告。
first run - C:/report/toxedo_report0.csv
C:/report/toxedo_report1.csv
C:/report/toxedo_report2.csv
@PythonDev這是否適合您? –
Muller是的,它是。謝謝:) – PythonDev