首页 > 解决方案 > 如何从表、.txt 文件、Python 3 中提取特定数据

问题描述

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

示例表 -

输入 姓名 中间名字 性别
123 山姆 米切尔 授予 男性
123 萨缪尔 不适用 菲努斯 男性
123 沙龙 伊丽莎白 格雷森 女性

实际数据 -

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

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

标签: python-3.xextracthelper

解决方案



推荐阅读