using python how to read only the first line of ping results? -


how read first line of ping results using python? on reading ping results python returns multiple lines. know how read , save 1st line of output? code should not work ping should work tools "ifstat" too, again returns multiple line results.

run command using subprocess.check_output, , return first of splitlines():

 import subprocess  subprocess.check_output(['ping', '-c1', '192.168.0.1']).splitlines()[0] 

andreas


Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -