import numpy
X = numpy.array([1, 2, 3, 4])
str = ' '.join(str(j) for j in X)
with open('X.txt', 'w+') as f:
f.write(str+'\n')
数组转换为字符串写入文件中
最新推荐文章于 2023-01-21 03:27:27 发布
import numpy
X = numpy.array([1, 2, 3, 4])
str = ' '.join(str(j) for j in X)
with open('X.txt', 'w+') as f:
f.write(str+'\n')