If I have a string such as
’17:31:51 up 134 days, 11:26, 1 user, load average: 0.22, 0.15, 0.10′
what is the best way to extract just the x3 load average values at the end? I have written a regexp that does this but is this the most efficient / fastest method?
>>> s = '17:31:51 up 134 days, 11:26, 1 user, load average: 0.22, 0.15, 0.10' >>> print re.findall(r'([0-9]\.\d+)', s) ['0.22', '0.15', '0.10']
This should work: