if语句,python中if语句的一般形式如下:

  conditon1为真,执行statement_block_1

  condition1为假,判断conition_2,如果condition_2为真,执行statement_block_2

  condition2为假,直接执行statement_block_3

注意:

  1、每个条件后,需要使用冒号,标识接下来是满足条件后执行的语句块;

  2、使用缩进来划分语句块,相同缩进数的语句在一起组成一个语句块;

  3、在python中没有switch--case语句。

如:

             if bool==1:
resultstr = (caseapiname, name, wish,"result值:"+str(bool),"成功")
resultmode(','.join(resultstr) + "\n")
elif bool=="":
testresult = result.get("error")
if testresult==wishresult[col]:
resultstr = (caseapiname, name, wish, testresult,"成功")
resultmode(','.join(resultstr) + "\n")
else:
resultstr = (caseapiname, name, wish, testresult,"失败")
resultmode(','.join(resultstr) + "\n")
else:
resultstr =(caseapiname, name, wish,result.get("error"),"失败")
resultmode(','.join(resultstr)+"\n")

最新文章

  1. phonegap之android原生日历调用
  2. JQuery_DOM 节点操作之创建节点、插入节点
  3. 笨办法学 Python (Learn Python The Hard Way)
  4. WinForm中使用XML文件存储用户配置及操作本地Config配置文件
  5. A Simple MVVM Example[Forward]
  6. 两种高性能I/O设计模式(Reactor/Proactor)的比较
  7. MySQL Error Handling in Stored Procedures---转载
  8. 生成唯一的id(转)
  9. Scala基础入门-2
  10. 2008r2 做windows域控制器
  11. Spring mvc 转发、重定向
  12. Opengl4.5 中文手册—A
  13. PHP 面试时常考的文件操作函数
  14. windows c++程序移植到linux的要点
  15. Android 之dragger使用
  16. [dev][crypto][strongswan] 有关strongswan的forward policy的源码分析
  17. jQuery - Detect value change on hidden input field
  18. Picture POJ - 1177(扫描线求面积并)
  19. iOS - UIAlertController三种显示提示框代码
  20. MySQL:安装mysqld系统及基础应用

热门文章

  1. Linux学习--第八天--acl、SetUID、SetGID、chattr、lsattr、sudo
  2. Microsoft Azure Overview
  3. java.lang.String (JDK 1.8)
  4. Caffe学习使用__运行caffe自带的两个简单例子
  5. SQLServer Transaction Isolation Level
  6. Redis 实战之主从复制、高可用、分布式
  7. 【HDU5289】Assignment
  8. Linux使echo命令输出结果带颜色
  9. linux常用基本命令不全
  10. wepy框架换行