0
所以我的代码蟒蛇urllib.request.urlopen递归失败
def constructGraph(self,url,doit=5):
if doit!=0:
m = urllib.request.urlopen(url)
print('test')
self.constructGraph('http://example.com',doit-1)
但后来当我运行它,它只能运行在第一m = urllib.request.urlopen(url)
只打印测试一次,即使它应该做两次。 ..
,当我运行调试器,它甚至不会去打印(“测试”)线在第二递归和仅是退出
我做了什么错?
我使用python 3
我没有立即看到你的代码有什么问题。你可以发布更多的类定义,或者你对constructGraph的初始调用看起来像什么? – phooji 2011-03-04 02:06:25
不知道它有什么问题。尝试打印'doit'和'm'的值,而不是'test'',可能会挖掘到'm'。 – Vamana 2011-03-06 18:16:22