uptime in unix

none "chris\" at (none)
Sun Sep 19 16:32:58 EDT 2004


Oli Schwarz wrote:
> Hello,
> 
> how can I read out the uptime of a unix system in python (Linux and *BSD).
> 
> I have not found a uptime-function in the Library.
> 
> Regards 
> Oli

You can call the uptime program from python and catch the ouput:


 >>> import os
 >>> print os.popen('uptime').read()
  21:29:57 up  9:35,  6 users,  load average: 1.33, 2.04, 2.08



More information about the Python-list mailing list