【发布时间】:2014-08-04 08:14:43
【问题描述】:
我正在处理两个文本文件,其中一个是中间列中的名称 ic,在另一个中我只有名称,我需要提取包含名称的行的所有列在另一个文件中提到, 有人知道怎么做吗? 最好的, 托梅克
【问题讨论】:
-
这些文本文件有任何列分隔符吗?你将如何从 txt 文件中获取第二列?
-
到目前为止你做了什么?向我们展示您的文本文件和源代码的示例。
-
To be honest I haven't really done anything, this is how the name file looks: CHEMBL102582_entry_00018_conf_02 CHEMBL102582_entry_00018_conf_14 CHEMBL102582_entry_00018_conf_15 CHEMBL102582_entry_00018_conf_41 CHEMBL102582_entry_00018_conf_52 this is how the file from which i have to extract looks AffCHEMBL1288585 AffCHEMBL1288585_entry_00004_conf_01.mol2 -74.8107 10000001000000100000 0.473684 AffCHEMBL1288585 AffCHEMBL1288585_entry_00004_conf_02.mol2 -71.2064 00000001000101100000 0.611111 AffCHEMBL1288585 AffCHEMBL1288585_entry_00004_conf_03.mol2 -68.9659 00000001000101100000 0.588235
-
awk很容易做到,并且有多个与此相关的问题/重复。如果您愿意接受非纯 python 解决方案,我建议您看看它。 PS:不要在评论中转储文本。 edit 你的答案。 -
@TomekStępniewski 请编辑您的问题并将您的数据放在那里。不要把它放在评论中。