I\'m looking for a fast and lightweight way to read system uptime from a Python script. Is there a way to call the sysinfo
Linux system call from Python?
Adding an UP TO DATE answer.
This may not be the fastest way. But this is should be the replacement for psutil.boot_time()
since I couldn't find boot_time
in latest versions of linux psutil
lib.
Dependancy:
pip3 install uptime
Usage:
>>> from uptime import uptime
>>> uptime()
49170.129999999997
More info