Python continue语句 --回到循环开头
continue 用来跳过之后的代码,直接回到 for 和 while 循环的开始;如果有循环嵌套,只作用于最深层的循环
continue 一般与条件判断语句 if 搭配,只能在循环语句内部使用
搭配for循环
1 | list = [ |
搭配while循环
1 | while True: |
continue 用来跳过之后的代码,直接回到 for 和 while 循环的开始;如果有循环嵌套,只作用于最深层的循环
continue 一般与条件判断语句 if 搭配,只能在循环语句内部使用
1 | list = [ |
1 | while True: |