在python 2.6.6中将数据写入excel文件的功能是什么
我尝试使用2.7.5,它工作正常,但是当我在python 2.6.6中运行相同的代码时,它给我回溯了最近的调用错误。 以下代码在2.7.5中有效,但在2.6.6中无效
def getSource(buildid_arr,csiid_arr,compname_arr):
timestr = time.strftime("%Y%m%d-%H%M%S")
with open('TTS-'+timestr+'.csv', 'w') as csvfile:
fieldnames = ['ALM','APPID','COMPONENT','BUILDIDENT','TRANSID','INITTIME','VERSIONSTR','RELEASENAME','SRC_DOWNLOAD_URL','PKG_DOWNLOAD_URL','PROMOTION_ENV','PROMOTION_DT']
writer = csv.DictWriter(csvfile, fieldnames=fieldnames)
writer.writeheader()
i=0
while i<len(buildid_arr):
writer.writerow({'ALM':"TTS",'APPID':csiid_arr[i],'COMPONENT':compname_arr[i],'BUILDIDENT':buildid_arr[i],'TRANSID':"null",'INITTIME':"null",'VERSIONSTR':"null",'RELEASENAME':"null",'SRC_DOWNLOAD_URL':'http://www.tts.icgbuild.nam.nsroot.net:3000/download/v1/files?build='+buildid_arr[i]+'&group=source','PKG_DOWNLOAD_URL':"null",'PROMOTION_ENV':"null",'PROMOTION_DT':"null"})
i+=1