-1
file_name = files.blobstore.create(mime_type='application/ms-excel', _blobinfo_uploaded_filename='sample.xls')
wbk = xlwt.Workbook()
sheet = wbk.add_sheet('Sheet 1')
stringa = str(newfile.text)
s3 = stringa.split('\n')
i=1
for riga in s3:
s2=riga.split()
try:
x = float(s2[0])
y = float(s2[1])
sheet.write(i, 1, '%g' %x)
sheet.write(i, 2, '%14.3e' %y)
except:
sheet.write(i, 1, '%s' %s2[0])
sheet.write(i, 2, '%s' %s2[1])
i=i+1
文件 「/base/data/home/apps/s~marco-busso/1.357756583016056739/helloworld.py」,線路140,在交 sheet.write(I,1, '%s'%s2 [0]) IndexError:列表索引超出範圍索引列表錯誤谷歌應用程序引擎
爲什麼?
謝謝....最後一行是empty.Can我控件添加刪除空行? – user1281174 2012-03-26 08:25:32
當然。例如,你可以將'for'循環的內容封裝在'if riga:'語句中。 – 2012-03-26 08:38:31
我已經添加了一個示例。 – 2012-03-26 08:54:17