python使用for...else跳出双重for循环

# -*- coding: utf-8 -*-
# @Time    : 2020/9/30 14:31
# @Author  : wmy
# -*- coding:utf-8 -*-

"""
功能:for...else语句跳出双重for循环
"""

for i in range(5):
    for j in range(5):
        if j == 3:
            print(j)
            break
    else:
        continue
    break

猜你喜欢

转载自blog.csdn.net/qq_36940806/article/details/108884980