Python 流程控制 条件语句 1 2if a: b 1 2 3 4if a: b else: c 1 2 3 4 5 6 7 8if a: b elif c: d elif e: f else: g else 和 elif 均可选。 循环语句 while 语句 1 2while a: b for 语句 1 2for i in a: b 循环控制 break:跳出当前循环 continue:跳出本次循环,进入下一次循环 循环的 else 语句 1 2 3 4while a: b else: c 1 2 3 4for i in a: b else: c 若循环正常执行完(没有经过 break),则在循环结束后执行 else 部分。