[英]How do I save a specific array value to a cell in Excel with Python?
I'm trying to save an array value into a cell in Excel using Python, but I can work out how. 我正在尝试使用Python将数组值保存到Excel中的单元格中,但是我可以找到方法。
I tried all of the followings but none worked: 我尝试了以下所有方法,但均无效果:
ws['A2'] = data[0][1]
ws['A2'] = 'data[0][1]'
cellValue = data[0][1]
ws['A2'] = cellValue
Obviously, I'm a beginner in Python! 显然,我是Python的初学者! Thanks in advance!
提前致谢!
Use the standard lib xlwt: 使用标准的lib xlwt:
wb = xlwt.Workbook() #create your workbook
ws = wb.add_sheet(sheet_name)
ws.write(n,m,my_data) # where n is the target row and m the column
in the end just save: 最后保存:
wb.save('workbook.xls')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.