我用numpy来做这件事。我有一个包含一系列数字的文本文件:
[ 11.1 44.0 74.9 103.8 115.8
157.0 170.1 208.4 239.9 296.8]
如何将文本文件转换为:
11.10377777 44.03133786 74.9749492 103.83874619 115.83058441 157.0862515 170.10200524 208.4376871 239.90138829 296.86073327
stim = a[0,61:71]
stim2 = a[0,21]
fname = 'blah'
f_events = open('L:\\directory\\' + blah + '.txt',"w")
f_events.write(str(stim-stim2))
f_events.close()