[英]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.