当前位置: 代码迷 >> 综合 >> python 条件语句,pass
  详细解决方案

python 条件语句,pass

热度:7   发布时间:2023-12-16 07:57:31.0

一、条件语句

    python的条件语句只有if一种,switch-case目前为止并不存在python中。

    if语句的基本实现:

if condition:statement;

    if-else实现:

if condition:statement
else condition:statement

    if-elif-else实现:

if condition:statement
elif condition:statement
else statement

二、pass关键词

    在python中,pass为空语句,是为了保持程序结构的完整性,一般不进行操作,常被用作占位符。

  相关解决方案