<div>dear everyone</div>  <div> </div>  <div>please help me with my coding dilemma o_O</div>  <div> </div>  <div>i have a python code that can ping several sites as shown below:</div>  <div> </div>  <div>=====================================================</div>  <div>=====================================================</div>  <div> </div>  <div>import threading<BR>import os<BR>import Queue<BR>import time<BR>from time import sleep</div>  <div> </div>  <div>def showResponse(args):<BR>    """Pretty prints passed tuple to stdout"""</div>  <div>    ip, stdoutLi, threadName = args<BR>    print '%s \t\t\t\t\t\n' % (ip)</div>  <div>    for line in stdoutLi:<BR>        line = line.strip()<BR>        if not line: continue<BR>        print '\t' + line<BR>    print '-'*72</div> 
 <div>class Pinger(threading.Thread):</div>  <div>    def __init__(self, host, queue):<BR>        threading.Thread.__init__(self)<BR>        self.__host = host<BR>        self.__queue = queue<BR>        self.setDaemon(1)</div>  <div>    def run(self):<BR>        pingCmd = "ping -n 1 -w 1000 " + self.__host<BR>        childStdout = os.popen(pingCmd)<BR>        result = (self.__host, childStdout.readlines(), self.getName())<BR>        childStdout.close()<BR>        self.__queue.put(result)</div>  <div><BR>if __name__ == '__main__':</div>  <div>  <BR>    hostLi = ['yahoo.co.uk','google.com','wikipedia.org'] # read from
 the list</div>  <div>    q = Queue.Queue()</div>  <div>    startA = time.time()<BR>    for host in hostLi:<BR>        """Create and start all necessary threads, passing results<BR>        back via thread safe Queue instance.<BR>        """<BR>      <BR>        Pinger(host,q).start()</div>  <div>    i = len(hostLi) # counts the length of hostLi<BR>        <BR>    while i > 0:<BR>        showResponse(q.get())<BR>        i -= 1<BR></div>  <div>=====================================================</div>  <div>=====================================================</div>  <div> </div>  <div>i would like to develop it more
 with the following requirements:</div>  <div> </div>  <div>1). i want to make the code to read the list of websites from another file (be it a .txt or .xls)</div>  <div>2). i want the results of the pings to be displayed in another file, where i can manipulate those figures later on for research purposes</div>  <div>3). if number (2) is achieved, i want the code to run every 60 minutes so i can make a statistic with those values, i.e. pinging to site A has less delay during the day compare to during night time or something like that</div>  <div> </div>  <div>i have several ideas of my own but they dont seem to work:</div>  <div>1). hostLi = open("ipaddress.txt")  # ipaddress.txt is the list of websites<BR>     for line in hostLi.readlines():<BR>          print line<BR>     hostLi.close()</div>  <div>  </div>  <div>     OR</div> 
 <div> </div>  <div>     f = open("ipaddress.txt")<BR>     while 1:<BR>          line = f.readline()<BR>          if not line: break<BR>               hostLi(line)<BR>     f.close()</div>  <div>2). myoutfile = showResponse(q.get()) # write this result to the file<BR>     theoutfile = open ("myout.txt","w") # open the file to write (w)<BR>     for item in myoutfile:  # write out the contents<BR>          theoutfile.write (item)</div>  <div>     theoutfile.close()</div>  <div>3). while i > 0:<BR>        showResponse(q.get())<BR>        i -=
 1<BR>    while 1:<BR>        time.sleep(3600)  # 60 minutes = 3600 seconds</div>  <div> </div>  <div>thank you very much for anyone who can help me out with these issues</div>  <div> </div>  <div>really appreciate it a lot!</div><p>
                <hr size=1>On Yahoo!7 <br> 
<a 
href="http://au.rd.yahoo.com/mail/tag/**http%3A%2F%2Fau.answers.yahoo.com%2F"> 
Answers: 25 million answers and counting. Learn something new today</a>