小编lea*_*eas的帖子

Try 和 except 都在被另一个函数调用时执行

我的代码发生了一些奇怪的事情,我有一个像这样的第一个函数:

def function1():
    try : #1
        #try to open a file
        #read file
        #return info variable from the file
    except : #1
        try : #2
            #try to open a web page
            #read web page
            if directory1 not in directorylist :
                #create directory1
                #change working directory to directory1
            else :
                #change working directory to directory1
            #write web page content in a file
            #return info variable from the file
        except : #2
            try : #3
                #try to open a second web page …
Run Code Online (Sandbox Code Playgroud)

python error-handling exception python-3.x

2
推荐指数
1
解决办法
3380
查看次数

标签 统计

error-handling ×1

exception ×1

python ×1

python-3.x ×1