美文网首页
条件判断

条件判断

作者: 黄大臻Dzreal | 来源:发表于2017-01-27 10:34 被阅读8次

条件判断:

if 语句:

if <条件判断1>:

<执行1>

elif <条件判断2>:

<执行2>

elif <条件判断3>:

<执行3>

else:

<执行4>

if 判断条件的简写形式:只要x是非零数值、非空字符串、非空list等,就判断为True,否则为False。

if x:

pass

与if语句相似的语句结构是 测试 :

try:

pass

except:

pass

相关文章

网友评论

      本文标题:条件判断

      本文链接:https://www.haomeiwen.com/subject/wiufittx.html