簡體   English   中英

Python XLWT:將列表寫入單元格

[英]Python XLWT: Write a list into a cell

我正在嘗試使用Python XLWT將列表寫入單元格。 這可能嗎?

我目前收到一個錯誤:

Exception: Unexpected data type <type 'list'>

代碼:

    for x in result:
        sheet1.write(row2,0,x[0])
        sheet1.write(row2,1,x[1])

x [1]將是一個列表。

謝謝!

首先嘗試將其轉換為字符串:

for x in result:
    sheet1.write(row2,0,str(x[0]))
    sheet1.write(row2,1,str(x[1]))

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM