Python savetxt标头

use*_*144 6 numpy python-2.7

我想在我写一个数组时为我的文本文件添加一个标题:

np.savetxt('output.txt', array, header = str(dimension))

但它看起来默认情况下Python添加#在标题前面.无论如何我可以摆脱那个?

eme*_*eth 13

作为numpy.savetxt,comment是前置的header.

所以,试试吧

np.savetxt('output.txt', array, header=str(dimension), comments='')
Run Code Online (Sandbox Code Playgroud)