Using 3rd python library: pyping

os.system does not give you any output from the command. I would do either of the following:

  1. Use Popen
from subprocess import Popen,PIPE
p = Popen("ping -n 1 www.google.com",stdout = PIPE)
output,err = p.communicate("")
print output[output.find("time")+5:output.find("TTL")-3]

Or
2. Use a module, depending on your goals

1 Like