so i have the code
def constructGraph(self,url,doit=5):
if doit!=0:
m = urllib.request.urlopen(url)
开发者_如何学C 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
Perhaps you can only have one request open at a time. Try putting a print statement before the urlopen call.
精彩评论