From: duncan at rcp.co.uk (Duncan Booth)
Date: 12 May 1999 08:03:59 GMT
Subject: catching results of ping on NT
References: <7ha62g$8fd$1@birch.prod.itd.earthlink.net>
Message-ID: <8DC45CD21duncanrcpcouk@news.rmplc.co.uk>
X-UID: 1819                                                 

[posted and mailed]

Benjamin Derstine <bend at realeducation.com> wrote in 
<7ha62g$8fd$1 at birch.prod.itd.earthlink.net>:

>I'm trying to write a script that saves the results of the ping command on
>NT.  I can make the ping command happen with os.system('ping...') .
>However, I can't figure out how to get the results of this command into a
>Python data structure.  I've studied the os and sys modules but they don't
>seem to have anything that can do this.
>Thanks,
>
>Ben
>
Try using popen:
 result = os.popen('ping -n 3 localhost').readlines()


-- 
Duncan Booth                                    duncan at dales.rmplc.co.uk
int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3"
"\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?
http://dales.rmplc.co.uk/Duncan




