Re: Pickle Problem



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?

Thanks,

Fabien

On Mar 3, 12:21 pm, odeits <ode...@xxxxxxxxx> wrote:
On Mar 3, 4:16 am, Fab86 <fabien.h...@xxxxxxxxx> wrote:



Thanks, this seems like a simpler way to do it.

I plan on recording 200 values to this file from the outcome of 200
Yahoo searches. Is there any type of loop I can make to do this or do
I have to have a line like "print >> f, res1.total_results_available"
200 times?

Regards,

Fabien

On Mar 3, 12:00 pm, "andrew cooke" <and...@xxxxxxxxxx> wrote:

maybe the following are simpler as they use print

if you are using python 2.6 or python 3:

from __future__ import print_function
f = open('myfile.txt', 'w')
print(123, file=f)
print(456, file=f)
f.close()

alternatively, in python 2.5 or 2.6:

f = open('myfile.txt', 'w')
print >> f, 123
print >> f, 456
f.close()

andrew

How are you getting res1, res2? in most cases you could just use a for
loop

for res in results:
   print >> f, res.total_results_available

.



Relevant Pages

  • document owner permission
    ... project server suggests me only some resouce which ... what particular authorization res1 and res2 have to be a document ... Can anybody suggest me which authorization I should set for a resouce ...
    (microsoft.public.project.pro_and_server)
  • ParentChild Dimension ,sum of same item multiple times
    ... Like Res1 is parent of Res2 ... Res2 is parent of Res4 and Res5. ... Suppose Res1 sales one item at 100$ to Res2 ...
    (microsoft.public.sqlserver.olap)
  • Re: Input Message
    ... And Res2 = vbNullString Then ... And Not Res2 = vbNullString Then ... However, try the follwing version: ... Res1 = Application.InputBox(_ ...
    (microsoft.public.excel.programming)
  • Re: Leveling How To
    ... in the second week only res1 is used and res2 sits idle? ... used in week2) ...
    (microsoft.public.project)
  • Re: Pickle Problem
    ... srch1 = WebSearch ... srch2 = WebSearch ... After identifying res1, I then use the total_results_available class ... for lang in langs: ...
    (comp.lang.python)