Dec-04-2018, 09:58 PM
(This post was last modified: Dec-04-2018, 09:59 PM by Martin2998.)
Hey all,
I want to ping a server and perform an action based on the result. My problem is getting the ping ressult in an format that i can use for in a if, else statement. ping is always 0 weither the ping is successful or not
Using Windows 10 and python 3.6.5
------------------------------------------------------------------------
import os
ping = os.system('ping 8.8.8.8')
if ping == 0:
print ('up')
else:
print('down')
Any help would be appreciated
I want to ping a server and perform an action based on the result. My problem is getting the ping ressult in an format that i can use for in a if, else statement. ping is always 0 weither the ping is successful or not
Using Windows 10 and python 3.6.5
------------------------------------------------------------------------
import os
ping = os.system('ping 8.8.8.8')
if ping == 0:
print ('up')
else:
print('down')
Any help would be appreciated