pythonurllib.request.urlopen递归fai

2024-09-26 18:02:34 发布

您现在位置:Python中文网/ 问答频道 /正文

所以我有密码

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')行,而只会退出

我做错什么了?在

我用的是python3


Tags: testselfcomhttpurl密码ifexample

热门问题