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

D. Hartley denise.hartley at gmail.com
Fri May 6 21:56:04 CEST 2005


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:
        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


More information about the Tutor mailing list