Michael McGarry wrote:
Hi,

I am horrible with Regular Expressions, can anyone recommend a book on it?

Also I am trying to parse the following string to extract the number after load average.

".... load average: 0.04, 0.02, 0.01"

how can I extract this number with RE or otherwise?

This particular example might be parsed more quickly and easily just by chopping it up:


s = ".... load average: 0.04, 0.02, 0.01"
[left, right] = s.split(":")
[av1, av2, av3] = map(float, map(str.strip, right.split(",")))



--
                           \/ \/
                           (O O)
-- --------------------oOOo~(_)~oOOo----------------------------------------
Keith Dart <[EMAIL PROTECTED]>
vcard: <http://www.kdart.com/~kdart/kdart.vcf>
public key: ID: F3D288E4       URL: <http://www.kdart.com/~kdart/public.key>
============================================================================
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to