help with processing text file

C. Ng ngcbmy at gmail.com
Thu Dec 4 23:46:17 EST 2014


Hi,

Given the sample text file below (where the gibberish represent the irrelevant portions) :

....
abcddsdfffgfg
ggfhghghgfhghgh   round 5 xccdcxcfd
sdfdffdfbcvcvbbvnghg score = 0.4533 
abcddsdfffgfg     round 5 level = 0.15
ggfhghghgfhghgh   round 10 dfsdfdcdsd
sdfdffdfbcvcvbbvnghg score = 0.4213 
sdsdaawddddsds    round 10 level = 0.13
......and so on....


I would like to extract the values for round, score and level:
5 0.4533 0.15
10 0.4213 0.13
....and so on...

Please advise me how it can be done, and what Python functions are useful.

Thanks.











More information about the Python-list mailing list