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
Post a Comment