【发布时间】:2019-02-14 13:58:25
【问题描述】:
我的文件中的行分布在多行上。在我文件的以下块中,第一行从 0.0000000000000000E+00 开始,而第二行从 1.5625000000000000E-02 开始。如何将 0.0000000000000000E+00 到 1.5625000000000000E-02 之前的一作为一行读取?
我正在尝试 numpy 的 genfromtxt() 函数和 pandas 的 read_csv(),但我还不能与系统交流我打算做什么。
#I have put quotation marks here just to indicate the start and end of rows. They
#are not part of the file.
"0.0000000000000000E+00
00000000 4.9999998882412910E-03 8.7714487508765548E-03
00000001 5.0000002374872565E-04 5.0877144875087654E-01"
"1.5625000000000000E-02
00000000 4.9999998882412910E-03 8.4622513106357884E-03
00000001 5.0000002374872565E-04 5.0864039953085094E-01"
正确读取后,我的输入数组如下所示:
0.0000000000000000E+00 00000000 4.9999998882412910E-03 8.7714487508765548E-03 00000001 5.0000002374872565E-04 5.0877144875087654E-01
1.5625000000000000E-02 00000000 4.9999998882412910E-03 8.4622513106357884E-03 00000001 5.0000002374872565E-04 5.0864039953085094E-01
【问题讨论】:
标签: python pandas numpy file-read