On 12/04/2014 08:46 PM, C. Ng wrote:
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.
I would use regular expressions. See
https://docs.python.org/3/library/re.html
Gary Herron
--
https://mail.python.org/mailman/listinfo/python-list