小编R. *_*ark的帖子

Python XLWT无法指定行高

我正在尝试使用xlwt和row.(i).高,但我没有结果.

我的代码:

import xlwt
book = xlwt.Workbook(encoding='latin-1')
sheet = sheet.add_sheet('KPI.TiempoRespuesta',cell_overwrite_ok=True)
sheet.write(1, 4, "BLABLABLABLABLABLABLABLABLABLABLABLA")
sheet.row(4).height = 256*20
book.save("book.xls")
Run Code Online (Sandbox Code Playgroud)

我想增加单元格高度; /,但行.(i).高不做任何事情

python xlwt

6
推荐指数
1
解决办法
7107
查看次数

带有xlwt的UnicodeDecodeError

我正在使用python和xlwt并且有问题

我的代码:

tickets = cursor.fetchall ()
largo = len(tickets)
cursor.close ()
conn.close ()

row = 4
for t in tickets:

  hoja.write(row, 1, t[0])
  hoja.write(row, 2, epoch2fecha(t[1]))
  hoja.write(row, 3, epoch2fecha(t[12]))
  hoja.write(row, 6, t[10])
  hoja.write(row, 7, t[9])
  hoja.write(row, 8, t[6])
  hoja.write(row, 9, t[3])
  row += 1
  if(row == largo+1):
     break
libro.save('Informe.xls')
Run Code Online (Sandbox Code Playgroud)

错误:

libro.save('informe.xlsx')
File "build/bdist.linux-x86_64/egg/xlwt/Workbook.py", line 662, in save
File "build/bdist.linux-x86_64/egg/xlwt/Workbook.py", line 637, in get_biff_data
File "build/bdist.linux-x86_64/egg/xlwt/Workbook.py", line 599, in __sst_rec
File "build/bdist.linux-x86_64/egg/xlwt/BIFFRecords.py", line 76, in get_biff_record
File "build/bdist.linux-x86_64/egg/xlwt/BIFFRecords.py", line 91, in …
Run Code Online (Sandbox Code Playgroud)

python xlwt python-2.7

4
推荐指数
1
解决办法
3074
查看次数

如何防止FOR循环过早结束?

码:

tsol = [6,7,8,9,10]
lenth = len(tsol)

for t,tnext in zip(tsol[0:lenth],tsol[1:lenth]):

  print t,tnext
Run Code Online (Sandbox Code Playgroud)

结果:

缺少6,7
7,8
8,9
9,10
和t值"10"

python for-loop

2
推荐指数
1
解决办法
140
查看次数

标签 统计

python ×3

xlwt ×2

for-loop ×1

python-2.7 ×1