[Tutor] function runs w/o error but produces no output (?) - possible spoiler

Marilyn Davis marilyn at deliberate.com
Fri May 6 22:26:28 CEST 2005


On Fri, 6 May 2005, D. Hartley wrote:

> Hey guys,
> 
> I wrote the following function, and if I do it line-by-line in the
> interpreter, each line works exactly as it should.  However, when I
> run the function by its name, nothing happens.  It doesnt print the
> print statement, it doesnt give me an error, it just goes to the next
> >>> line.  This is probably an easy fix, but I traced through it about
> twelve times and can't figure out why it's not doing what it should.
> The pdb debugger didnt give me anything I could actually read.
> 
> Any ideas?
> 
> def urlsearch():
>     x = 12345
>     count = 0
> #    pdb.set_trace()
>     while count > 10:

If count is set to 0 above, then this will never happen because 0 is
not > 10.

>         param = urllib.urlencode({'nothing': x})
>         f = urllib.urlopen("http://www.pythonchallenge.com/pc/def/linkedlist.php?%s"
> % param)
>         text = f.read()
>         print text
>         lister = string.split(text)
>         x = lister[-1]
>         count = count + 1
> 
> Thanks :) 
> ~Denise
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
> 

-- 



More information about the Tutor mailing list