正如标题所说,我想使用python将二维数组写入带有分隔符','的csv文件.我的数组看起来像这样(ndarray):
a= [[1,2,3,4],[5,6,7,8]]
Run Code Online (Sandbox Code Playgroud)
我希望输出看起来像:
1,2,3,4
5,6,7,8
with open('./data/positive.csv','wb') as myfile:
wr = csv.writer(myfile) #, quoting=csv.QUOTE_ALL)
wr.writerow(a)
Run Code Online (Sandbox Code Playgroud)
我该如何做到这一点?
我已经尝试过这个解决方案,但由于我在''行'中放错了's'而导致我的数组写入单行而不是多行,因此无效.