-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