如何从 table、.txt 文件中提取特定数据,Python 3

How to pull specific data from table, .txt file, Python 3

我想从保存为 .txt 文件的 table 中提取 2 列(输入和姓氏)的数据,然后生成包含两列的输出文件(通过编写脚本) (输入和姓氏)。我知道如何使用普通行执行此操作,但不知道从哪里开始使用 table 格式。

示例table -

Input Name Middle-name Surname Gender
123 Sam Mitchell Grant Male
123 Sameuel n/a Fineus Male
123 Sharron Elizabeth Graceson Female

实际数据-

Input   Input Type  MGI Gene/Marker ID  Symbol  Name    Feature Type
GO:0003723  Gene Ontology (GO)  MGI:87879   Aco1    aconitase 1 protein coding gene
GO:0003723  Gene Ontology (GO)  MGI:88022   Ang angiogenin, ribonuclease, RNase A family, 5 protein coding gene
GO:0003723  Gene Ontology (GO)  MGI:88042   Apex1   apurinic/apyrimidinic endonuclease 1    protein coding gene

table 的第二行从 GO:0003723 开始,每个新行也从 GO:0003723 开始。

您可以使用 csv 模块解析制表符分隔值文件,如图所示 here