python 条件语句,pass

一、条件语句

    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为空语句,是为了保持程序结构的完整性,一般不进行操作,常被用作占位符。

猜你喜欢

转载自blog.csdn.net/qq_38344394/article/details/80397476