Pinging using subprocess module in Python

In this program, we are going to ping www.aroliant.com using the subprocess module in python.Subprocess module is used to call/execute system level commands.

Source code :

import subprocess


subprocess.call(['ping','www.aroliant.com'])

Output :

Pinging aroliant.com [...] with 32 bytes of data:
Reply from 162.215.252.105: bytes=32 time=325ms TTL=49
Reply from 162.215.252.105: bytes=32 time=325ms TTL=49
Reply from 162.215.252.105: bytes=32 time=342ms TTL=49
Reply from 162.215.252.105: bytes=32 time=332ms TTL=49

Ping statistics for 162.215.252.105:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 325ms, Maximum = 342ms, Average = 331ms

Output :


                

Comments :