#3次元配列(720*1080*3)
sample = [[[0,0,0],[0,0,0],[..]..], [..]]
def ndarray_to_csv(file_name, ndarray):
with open(file_name, 'w') as f:
writer = csv.writer(f)
for value in ndarray:
writer.writerow(value)
ndarray_to_csv('sample.csv', sample)
1import numpy as np
23sample =[[[0,0,0],[5,5,5]],[[1,1,1],[2,3,2]]]45defndarray_to_csv(file_name, ndarray):6 ndarray ="\n".join([",".join([str(n)for n in narray])for narray in ndarray])7withopen(file_name,'w')as f:8 f.write(ndarray)910ndarray_to_csv('sample.csv', sample)11print(sample)
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2020/11/06 13:46
2020/11/06 23:45 編集
2020/11/07 00:43
2020/11/07 01:36