【发布时间】:2021-10-14 14:48:58
【问题描述】:
我有 .txt 文件,其中包含 ML 的数据。每个文件有 19 个条目,这些条目在文本文件中一次又一次地重复。我需要在 python 中以这样的方式获取这些文件,即每个条目都成为一列,并且它们相应的数值被放置在该列中。 我需要对 txt 文件中设置的所有 19 个条目执行此操作(如下面的“1”)。或仅包含数字数据的文本文件也可以(如下面的“2”)。如果您可以在 python 中为此编写一个很棒的代码,否则请描述一些详细信息如何做到这一点
我想要的输出:
1click to view image 或者 2click to view image
文本文件:
Frame.id:263126,时间戳:697287019071,Hand_number:1 ,hand_Id_type: 238右手 ,hand_finger's_number:2,手方向: (-0.142081, 0.865413, -0.480493) ,手掌位置: (35.2841, 284.522, 330.828) ,手掌法线: (-0.686854, -0.435733, -0.58) ,finger_type(tipposition) TYPE_THUMB(-36.7239, 301.602, 330.845) ,finger_type(tipposition) TYPE_INDEX(-14.9321, 347.039, 280.375) ,finger_type(tipposition) TYPE_MIDDLE(5.5661, 258.191, 321.318) ,finger_type(tipposition) TYPE_RING(20.0886, 251.219, 320.136) ,finger_type(tipposition) TYPE_PINKY(27.5919, 259.584, 310.508) Frame.id:263127,时间戳:697287037765,Hand_number:1 ,hand_Id_type: 238右手 ,hand_finger's_number:2,手方向: (-0.167599, 0.827034, -0.536587) ,手掌位置: (31.7441, 283.449, 322.619) ,手掌法线: (-0.776892, -0.445873, -0.44) ,finger_type(tipposition) TYPE_THUMB(-38.8083, 304.444, 330.446) ,finger_type(tipposition) TYPE_INDEX(-22.0532, 344.008, 273.496) ,finger_type(tipposition) TYPE_MIDDLE(-0.161068, 258.09, 319.489) ,finger_type(tipposition) TYPE_RING(13.8233, 250.236, 317.138) ,finger_type(tipposition) TYPE_PINKY(20.1892, 257.352, 305.739) Frame.id:263128,时间戳:697287057570,Hand_number:1 ,hand_Id_type: 238右手,hand_finger's_number:2,手方向: (-0.179139, 0.817551, -0.547284) ,手掌位置: (30.8754, 280.871, 315.444) ,手掌正常: (-0.750039, -0.473481, -0.473481, -0.461 ,finger_type(tipposition) TYPE_THUMB(-40.4781, 299.689, 321.24) ,finger_type(tipposition) TYPE_INDEX(-23.5209, 339.286, 264.435) ,finger_type(tipposition) TYPE_MIDDLE(-0.157164, 254.483, 311.627) ,finger_type(tipposition) TYPE_RING(14.1716, 247.067, 309.742) ,finger_type(tipposition) TYPE_PINKY(20.45, 254.358, 298.274) Frame.id:263129,时间戳:697287076710,Hand_number:1 ,hand_Id_type: 238右手,hand_finger's_number:2,手方向: (-0.191306, 0.830611, -0.522961) ,掌位: (28.6877, 277.055, 299.705) ,掌正常: (-0.739979, -0.472093, -0.493) ,finger_type(tipposition) TYPE_THUMB(-42.9838, 294.545, 305.915) ,finger_type(tipposition) TYPE_INDEX(-26.5976, 335.972, 250.27) ,finger_type(tipposition) TYPE_MIDDLE(-1.90294, 250.26, 294.934) ,finger_type(tipposition) TYPE_RING(12.5955, 243.157, 292.909) ,finger_type(tipposition) TYPE_PINKY(18.5831, 250.968, 281.465)
文本文件链接:https://drive.google.com/file/d/1X1NdQNYlQWuNpmzGL6Wwi_SqFjIXnRbb/view?usp=sharing
【问题讨论】:
-
请打开文件,或使用pastebin。
-
@srdg 很抱歉给您带来不便,现在开放访问。