Python xlwt简单wirting到工作表示例

时间:2014-12-07 17:18:16

标签: python xlwt

有人可以解释为什么我会收到以下错误:

File "C:\Users\Saul Ramirez\Documents\Python Scripts\DQforecast.py", line 156, in xlsOutput
forecastSheet.write(index, i, 'asdf')

TypeError: object of type 'int' has no len()    

此功能,

def xlsOutput(forecasts):
    os.chdir('C:\\Users\\Saul Ramirez\\Desktop')
    forecastWB = xlwt.Workbook()
    forecastWB_name = 'Forecasts' + str(datetime.date.today()) + '.xls'
    forecastSheet = forecastWB.add_sheet('Forecasst')
    i=0
    for rollRate in forecasts:
        for index in rollRate:
            forecastSheet.write(index, i, 'asdf')
        i=i+1

forecastWB.save(forecastWB_name)

0 个答案:

没有答案