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?
sysinfo
You can try installing psutil with:
psutil
pip install psutil
and then use the following fragment of code:
import psutil import time def seconds_elapsed(): return time.time() - psutil.boot_time() print seconds_elapsed()