2016-07-04 47 views
0
def fun_name(): 
for condition: 
    for condition: 
    if condition: 
    #continue 
    else: 
    pass 

如何跳轉到外部for循環,因爲在python中沒有goto或label關鍵字? 繼續將返回到內循環。有沒有辦法做到這一點?替代python中的Goto關鍵字

+3

爲什麼不提取內循環到函數,那麼你可以'返回'。 – jonrsharpe

回答

1

使用'break'關鍵字來突破內部循環。