【发布时间】:2018-12-10 12:07:35
【问题描述】:
我需要你的帮助来使用 python 解决这个问题。
我有一个名为good_files 的.txt 文件,其中每一行都是通向新文件的路径。
在每个文件中,我必须将两列数据合并在一起以进行曲线拟合。
我的问题是我该怎么做?对我来说最大的问题是了解如何构建循环以读取文件good_file.txt 的每一行,打开该路径的文件并获取两列数据将它们放入一个新文件中。抱歉,我现在是编码方面的菜鸟。谢谢你们的帮助,伙计们
【问题讨论】:
-
举例说明 good_files.txt 文件的外观。用你刚才说的很难理解文件的结构。
-
good_files.txt 的结构是这样的:secondolotto_1/Station_1__11/Station_1__11_Summary/Chip_004/S_curve/Ch_3_offset_0_Chip_004.txt secondolotto_1/Station_1__11/Station_1__11_Summary/Chip_004/S_curve/Ch_4_ 等。跨度>
-
例如文件 secondolotto_1/Station_1__11/Station_1__11_Summary/Chip_004/S_curve/Ch_3_offset_0_Chip_004.txt 看起来像 $$\begin{matrix} 210 & 0 & 0 \\ 215 & 0 & 0 \\ 219 & 3 & 0 \\ 222 & 326 & 326 \\ 224 & 966 & 966 \\ 226 & 1000 & 1001 \\ \end{matrix}$$ 我将每个文件的第一列和第二列合并到一个文件中然后我会用它来做适合