2
在:How to write numpy arrays to .txt file, starting at a certain line?如何將numpy數組寫入.txt文件,從某一行開始? numpy版本1.6
人們幫助我解決了我的問題 - 這適用於numpy版本1.7或更高版本。可惜的是我必須使用1.6版本 - follwoing代碼(謝謝@Praveen)
extra_text = 'Answer to life, the universe and everything = 42'
header = '# Filexy\n# time operation1 operation2\n' + extra_text
np.savetxt('example.txt', np.c_[time, operation1, operation2],
header=header, fmt='%d', delimiter='\t', comments=''
給我一個錯誤與numpy的1.6
numpy.savetxt() got an unexpected keyword argument 'header' · Issue ...
有一個變通的產生1.6版結果相同:
# Filexy
# time operation1 operation2
Answer to life, the universe and everything = 42
0 12 100
60 23 123
120 68 203
180 26 301
爲什麼要使用不推薦的numpy?如果是關於管理員權限,請查看pyenv。 –