get system uptime with Python on a Raspberry Pi

I found another solution: https://www.raspberrypi.org/forums/viewtopic.php?t=164276

#!/usr/bin/python3

import shlex, subprocess
cmd = "uptime -p"
args = shlex.split(cmd)
p = subprocess.Popen(args, stdout=subprocess.PIPE)
output = p.communicate()

Thanks for your posted ideas. print (output)

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top