mehmet
mehmet

Reputation: 110

Python parsing numbers

hi im new in python and trying to parse a file which has thousands of lines like these

gi162312575refNC0034243 ABCC Z_DNA_Motif 13204 13213 . + . ID=gi162312575refNC0034243_13204_13213_ZDNA;length=10;score=35;composition=2A/3C/3G/1T;sequence=gcacacgtgt;subset=1

gi162312575refNC0034243 ABCC Z_DNA_Motif 26389 26398 . + . ID=gi162312575refNC0034243_26389_26398_ZDNA;length=10;score=35;composition=0A/1C/5G/3T;sequence=gtgtgcgtgt;subset=1

I am trying to parse the numbers at the upper right corner so i can parse another file(string[13204:13213]...) but i couldnt get the numbers.How can i get them?

Upvotes: 0

Views: 93

Answers (1)

Silas
Silas

Reputation: 468

If the format is the same for all the strings, you can split them on whitespace and take element 3 and 4

string.split()[3:5]

Upvotes: 1

Related Questions