python的if语句
2016-06-12 22:42
330 查看
a=[2,3,4] if a[0]>3: print("this is run") elif a[2]==4: print "this is four" else: print "no run" b=(1,2,3,4) if b[0]>2: print "this is one step" else: print "this is two step" # output # this is four # this is two step语法中语句的尾部都加了冒号。这是感觉和C中不同之处。而且条件表达式不用括号。
相关文章推荐
- python
- Python升级导致的yum错误
- python中的字典遍历
- Hello Python
- python中字符串的操作符+,和*号
- Python 3.X 调用多线程C模块,并在C模块中回调python函数的示例
- python逻辑表达
- Python+Selenium进行UI自动化测试项目中,常用的小技巧1:读取excel表,转化成字典(dict)输出
- 使用Theano实现kaggle手写识别:logistic regression
- python虚拟环境的使用
- Python 的类学习笔记一
- python爬虫之爬取网页
- 进程、线程和协程的区别是什么
- 开源一套数据异地备份系统
- Python 模块使用
- 【忽略】Python操作数据库
- Python 偏函数
- python问题
- Python爬虫第一步之获取网页源代码
- OpenStack Python知识(1):with函数使用