0

so i have the code

def constructGraph(self,url,doit=5):
    if doit!=0:
        m = urllib.request.urlopen(url)
        print('test')
        self.constructGraph('http://example.com',doit-1)

but then when I run it, it only runs the first m = urllib.request.urlopen(url) and only prints test once even though it supposed to do it twice...

and when i run the debugger, it wouldn’t even go to the print('test') line on the second recursion and would just exit

what did i do wrong?

i'm using python 3

4

1 に答える 1

0

おそらく、一度にオープンできる要求は 1 つだけです。urlopen 呼び出しの前に print ステートメントを置いてみてください。

于 2013-04-09T05:27:52.123 に答える