On Apr 14, 2006, at 6:30 PM, david brochu jr wrote: > I am trying to ping websites and output the results to a txt file: > > import os > > file = open("c:\python24\scripts\ip.txt") > redirect = open("c:\python24\scripts\log.txt","a") > > for x in file: > ping = "ping " + x > print >> redirect, os.system(ping) > > > but the results seen in the log.txt file are: > > 0 > 0 > 0 > 0 > 0 > 0 > 0 > 0 > > > What am i doing wrong?? How do I fix this so I can see the ping > statistics inside the log.txt file?
os.system does not return the output of the command. Look at os.popen. Dave -- http://mail.python.org/mailman/listinfo/python-list