我在这个网站上找到了一些有用的东西,但我的输入文件与已经发布的示例不同,我无法以有效的方式实现飞跃。在
我的输入文件如下所示:
sample_dude data1 data2 data3 data4
sample_lady data5 data6 data7 data8
sample_dude data9 data10 data11 data12
sample_child data13 data14 data15 data16
我想为每个示例创建一个包含所有数据列的单独文件。例如,一个文件名为sample_花花公子.txt看起来像这样:
^{pr2}$样本数量未知,但始终只有四个数据列。在
非常感谢任何帮助。非常感谢。在
PS:我正在尝试用python来实现这一点。在
试试这样的吗?拆分将所有文件名映射到列列表,创建并向每个文件写入行。在
您可以通过打开文件并遍历每一行来完成此操作。我不会为您编写代码,但这里有一个算法。在
您还可以在打开所有文件进行写入之前保存它们的数据。如果有多行文件,这会更快。在
例如:
相关问题 更多 >
编程相关推荐