所以我有代码
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)
并且只打印一次测试,即使它应该做两次......
当我运行调试器时,它甚至不会在第二次递归时转到print('test')行并退出
我做错了什么?
我正在使用python 3
答案 0 :(得分:0)
也许您一次只能打开一个请求。尝试在urlopen调用之前放置一个print语句。