I am a newbie in Python programming language. My aim is to save (or write) my output variables i.e a, b and c (as in the following code) in the excel file sheet (.xlsx format) I have tried the following python code, for writing my output variables. I want an output excel file (.xlsx) like this:See the image of the excel file . The code is working fine with the .csv file, but its not working for .xlsx files
Following I want to achieve:
- I want to save each variable (a,b,c) in different columns of excel sheet
- I want to give names to each columns in excel sheet as (in each columns a, b, c will be stored, and the three columns name should be Value, Cross-range and A-value respectively)
Could anyone please help me on this ? Any suggestions or help regarding this ?
n=10
for i in range(n-1):
a[i+1] = a[i]-2
b=a/10
c=b**2
file = open("sample-test.xlsx","w")
for i in range(len(y)):
iter = "%.3f,%.3f,%.5f\n"%(a[i],b[i],c[i])
print (iter)
file.write(iter)
file.close()