2021年5月5日星期三

adding extra row to text file in python

I have a code that is something like that:

x = zip(sources,clist,RMSlist,residuelist)  name1 = string("sources")  name2 = string("clist")  name3 = string("RMSlist")  name4 = string("residuelist")  y = zip(name1,name2,name3,name4)  with open('test.csv', 'w') as f:    writer = csv.writer(f, delimiter='\t')    writer.writerows(y)     writer.writerows(x)     

My goal is to write each array in a column, but i want above that column a definition (a name) for it. Which was my attempt with the 4 names defined.

It Just for the sake of understanding the text file output better

https://stackoverflow.com/questions/67410928/adding-extra-row-to-text-file-in-python May 06, 2021 at 10:07AM

没有评论:

发表评论