Answer the question
In order to leave comments, you need to log in
How to use variables instead of numbers in txt='0,1,2,3,4'?
Hello everyone, after parsing, I need to get a beautiful table view in Excel after parsing, I found this code on some forum, it helps to create a table view, but the numbers are indicated there, and I need what I have to parse, that is, use my variables instead of numbers 0,1,2,3,4, how to do it? What happens as a result of this, I will show the screen below.
import xlwt
book = xlwt.Workbook()
sheet1 = book.add_sheet("Sheet1")
cols = ["A", "B", "C", "D", "E"]
txt = [0,1,2,3,4]
for num in range(5):
row = sheet1.row(num)
for index, col in enumerate(cols):
value = txt[index] + num
row.write(index, value)
book.save("test.xls")
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question