Is there a way for Python to send ping and get results, 1 or 0, without the console popping out? I need the results for UI change in style.
I've been trying import os
and it still shows the console, as well as subprocess
.
This is the sample I get from other questions but I can't get the console not to show.
import os
hostname = "google.com"
response = os.system("ping-c 1 " + hostname)
if response == 0:
print hostname, 'is up!'
else:
print hostname, 'is down!'
Thanks for the help.