【发布时间】:2018-06-12 11:27:05
【问题描述】:
我在文件中保存的值是:
[0. 0.5 1. 1.5 2. 2.5000002 .......] [1.00000000e+00 5.32289624e-01 3.31494868e-01 2.17292413e-01 1.46866933e-01 1.01670586e-01......]
但我希望将值保存为:
0.0 1.00000000e+00
0.5 5.32289624e-01
1.0 3.31494868e-01
1.5 2.17292413e-01
2.0 1.46866933e-01
2.5 1.01670586e-01
因此它可以很容易地在图表中绘制。
这是我的python代码部分:
time = hb_ac.solution['time']
results = hb_ac.solution['results']
tau = hb_ac.solution['tau']
fit=hb_ac.solution['fit']
estimate = hb_ac.solution['estimate']
with open('CaOw2.4dat', 'w') as out:
out.write("{time} {results}".format(time=time,results=results))
关于如何在此处使用 zip 功能以获得所需格式的输出的任何建议。
【问题讨论】: