FAQ

Binu K S wrote:
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'
Thank you.

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 4 of 11 | next ›
Discussion Overview
grouppython-list @
categoriespython
postedDec 15, '04 at 6:16a
activeDec 15, '04 at 3:20p
posts11
users9
websitepython.org

People

Translate

site design / logo © 2022 Grokbase