I am new to Python. I need to write some data from my program to a spreadsheet. I searched on the Internet and there seem to be many packages available (xlwt, XlsXcessive, openpyxl). Others suggest writing to a .csv file (never used CSV and didn't quite understand what it was).
The program is very simple. I have two lists (float) and three variables (strings). I do not know the length of the two lists, and they probably will not be the same length.
I want the layout to be as in the image below:

The pink column will have the values of the first list, and the green column will have the values of the second list.
So what is the best way to do this?
PS I use Windows 7, but I do not have to have Office installed on computers with this program.
import xlwt x=1 y=2 z=3 list1=[2.34,4.346,4.234] book = xlwt.Workbook(encoding="utf-8") sheet1 = book.add_sheet("Sheet 1") sheet1.write(0, 0, "Display") sheet1.write(1, 0, "Dominance") sheet1.write(2, 0, "Test") sheet1.write(0, 1, x) sheet1.write(1, 1, y) sheet1.write(2, 1, z) sheet1.write(4, 0, "Stimulus Time") sheet1.write(4, 1, "Reaction Time") i=4 for n in list1: i = i+1 sheet1.write(i, 0, n) book.save("trial.xls")
I wrote this using all your suggestions. He does his job, but can be slightly improved.
How to format cells created in a for loop (list1 values) as scientific or numeric?
I do not want to truncate the values. The actual values used in the program will have about 10 digits after the decimal.