[問題] ping ip 取得延遲時間
想請問板上各位先進
有辦法藉由python取得延遲時間如下紅字部分
目前只會做到ping host取得狀態
import os
hostname = "google.com" #example
response = os.system("ping -c 1 " + hostname)
if response == 0:
print(hostname, 'is up!')
else:
print(hostname, 'is down!')
想要把延遲時間紀錄於純文字中
謝謝了
Ping 8.8.8.8 (使用 32 位元組的資料):
回覆自 8.8.8.8: 位元組=32 時間=12ms TTL=52
回覆自 8.8.8.8: 位元組=32 時間=3ms TTL=52
回覆自 8.8.8.8: 位元組=32 時間=2ms TTL=52
回覆自 8.8.8.8: 位元組=32 時間=2ms TTL=52
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 210.242.44.65 (臺灣)
※ 文章網址: https://www.ptt.cc/bbs/Python/M.1574644908.A.42F.html
→
11/25 11:16,
5年前
, 1F
11/25 11:16, 1F
→
11/25 11:16,
5年前
, 2F
11/25 11:16, 2F
Python 近期熱門文章
PTT數位生活區 即時熱門文章