Storing value from a parsed ping

后端 未结 4 939
孤城傲影
孤城傲影 2021-01-28 10:19

I\'m working on some code that performs a ping operation from python and extracts only the latency by using awk. This is currently what I have:

from os import sy         


        
4条回答
  •  迷失自我
    2021-01-28 10:52

    os.system() returns the return code of the called command, not the output to stdout.

    For detail on how to properly get the command's output (including pre-Python 2.7), see this: Running shell command from Python and capturing the output

提交回复
热议问题