I would like to pull data from 2 columns (Input & Surname) from a table that is saved as a .txt file and then generate an output file (by writing a script) with the two columns (Input and Surname). I know how to do this with normal lines but have no idea where to start with a table format.
Example table -
Input | Name | Middle-name | Surname | Gender |
---|---|---|---|---|
123 | Sam | Mitchell | Grant | Male |
123 | Sameuel | n/a | Fineus | Male |
123 | Sharron | Elizabeth | Graceson | Female |
Actual data -
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
The second row of the table starts from GO:0003723 and each new row starts with GO:0003723 as well.
You can use the csv module to parse tab seperated value files as shown here.