You can do this without regular expressions if you like >>> uptime='12:12:05 up 21 days, 16:31, 10 users, load average: 0.01, 0.02, 0.04' >>> load = uptime[uptime.find('load average:'):] >>> load 'load average: 0.01, 0.02, 0.04' >>> load = load.split(':') >>> load ['load average', ' 0.01, 0.02, 0.04'] >>> load[1].split(',') [' 0.01', ' 0.02', ' 0.04']
One liner: >>> uptime[uptime.find('load average:'):].split(':')[1].split(',')[0] ' 0.01' On Tue, 14 Dec 2004 23:16:43 -0700, Michael McGarry <[EMAIL PROTECTED]> 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? > > Michael > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list