[Tutor] ping question...

Karl Pflästerer sigurd at 12move.de
Tue Dec 9 11:33:46 EST 2003


Slaybaugh Laura J IHMD <- SlaybaughLJ at ih.navy.mil wrote:

> My first stab was a simple x=os.system('ping -n 1 <ipaddress>'),
> unfortunately whether or not I run this line against a computer with a
> request timed out response, x equals 0.  Which helps me not at all.  

os.system does only the return value of the command you run; but you
want the output of ping.  So you look for os.popen() (and friends there
are some popen functions).

If you wanted to see the output of ping it could be:
for line in os.popen(''ping -n 1 <ipaddress>'):
    print line,



   Karl
-- 
Please do *not* send copies of replies to me.
I read the list




More information about the Tutor mailing list