Writing array to csv python (one column)

前端 未结 5 957
一整个雨季
一整个雨季 2021-01-14 02:09

I\'m trying to write the values of an array to a .csv file in python. But when I open the file in excel, the data is shown in one row. I want to have one column where each m

5条回答
  •  我在风中等你
    2021-01-14 03:09

    Try this:

        for i in range(len(testLabels)):
            result_file = open('filePath.csv', 'a')
            result_file.write("{}{}".format(testLabels[i], '\n'))
    

提交回复
热议问题