Python学习笔记04
2015-08-05 16:14
417 查看
语句之后有冒号,表示有一个语句块,且以四个空格的缩进来表示隶属关系。
与C# 相比,没有了{},没有了(),被冒号和缩进取代了
if,while,for,range,continue,break
if语句格式:
for语句格式:
while语句格式:
函数:
值传递和引用传递,其中list是引用传递。
可以返回多个值:return (a,b,c)
与C# 相比,没有了{},没有了(),被冒号和缩进取代了
if,while,for,range,continue,break
if语句格式:
i = 3 if i == 1: print i elif i == 3: print 3 else: print 2; |
for a in [1,3,True,'daniu']: print a; |
i = 1 while i < 10: i = i+1 if i== 2: continue if i== 4: break; print i |
值传递和引用传递,其中list是引用传递。
可以返回多个值:return (a,b,c)
def get_result(a,b): return (a,b, a+ b) print get_result(4,5) |
相关文章推荐
- python--str的几个方法
- Python 之 向上取整、向下取整以及四舍五入函数
- Python3切换TP-LINK外网IP(ADSL)
- python eval函数 动态执行python语句
- python中的字典详细介绍
- Python中eval带来的潜在风险
- Python实现ssh批量登录并执行命令
- Python学习笔记03
- python的logging模块,记录所发生的异常。
- python中的reduce函数
- 机器学习实战之朴素贝叶斯进行文档分类(Python 代码版)
- python问题:IndentationError:expected an indented block错误解决
- myeclipse python下配置文档说明_转载
- python多线程编程(4): 死锁和可重入锁
- python下安装lxml
- python 爬虫 爬下图片
- python中类方法和静态方法
- Python学习笔记02
- Python3 win7安装BeautifulSoup
- Python快速教程博客园地址