【发布时间】:2015-12-12 14:37:40
【问题描述】:
我有几个列表都想导出到同一个 .txt 文件。
到目前为止,我只使用导出 3 个列表
my_array=numpy.array(listofrandomizedconditions)
my_array2=numpy.array(inputsuser)
my_array3=numpy.array(reactiontimesuser)
combined=numpy.column_stack([my_array,my_array2,my_array3])
numpy.savetxt(participantnumber + ".txt", combined, delimiter=" ", fmt ="%-12s")
这给了我这样的输出
CongruentPositief no input or wrong button no reactiontime
IncongruentNegPos no input or wrong button no reactiontime
由于这很难阅读,我想在所有不同列表之间添加一个选项卡。
我还想添加一些列表,这些列表不像前 3 个那样长,但不是 192 个元素,但随后我得到一个错误,即每个数组必须具有相同的大小。有没有解决的办法?
【问题讨论】:
-
你为什么使用数组?为什么不使用列表和字符串?