Raspberry pi 2 os.System() command returning 0

204 Views Asked by At

OK so I am using a raspberry pi 2 and using python to run a command on terminal. Usually I'm using os.system('terminal Command here'). the problem with that is, when i run the program using sudo python3 filename it will print the command i want it to but it also prints a 0. I'm guessing that the 0 is a sign that the command ran successfully but i don't want the 0 to appear. Is there any way to get rid of it returning 0

1

There are 1 best solutions below

1
On

My Code is:

import os
import sys

print(os.system("sudo arp -a"))

it prints the output for the "Sudo arp -a" command but then after that it also puts a 0 on the next line.