On Mar 3, 1:02 pm, MRAB <goo...@mrabarnett.plus.com> wrote: > Fab86 wrote: > > I am getting res1 and res2 etc from this code: > > > srch1 = WebSearch(app_id=YahooKey) > > srch1.query = "avoir site:.al" > > res1 = srch1.parse_results() > > > srch2 = WebSearch(app_id=YahooKey) > > srch2.query = "avoir site:.fr" > > res2 = srch2.parse_results() > > > After identifying res1, I then use the total_results_available class > > which saves res1 as an integer. > > > This is happening 200 times. > > > How could I make a for loop to do this? > > langs = ["al", "fr"] > for lang in langs: > srch = WebSearch(app_id=YahooKey) > srch.query = "avoir site:.%s" % lang > res = srch.parse_results() > print >> f, res.total_results_available > > You might be able to move the "WebSearch" line out of the loop. > > Anyway, have you read through a tutorial?
thanks for this, works perfectly just as I wanted it to. Again, thanks to everyone who has helped me. Fabien -- http://mail.python.org/mailman/listinfo/python-list