- 博客(5)
- 资源 (10)
- 收藏
- 关注
原创 python5:序列之list
list是可变序列,通常用于存储同类型的元素。下面介绍list的专用方法,并且介绍几种使用list的数据结构。构造listlist可以使用下面几种方法构造: 1)用一对方括号表示一个空list:[]; 2)用方括号,元素使用逗号分隔:[a],[a,b,c]; 3)用表达式:[x for x in iterable]; 4)使用list函数:list(
2015-03-30 16:17:24 2320
原创 python4:序列概览
Python中的序列类型包括list、tuple、range、二进制数据、text和string,这里对序列的公共操作做一个介绍,后面将陆续介绍每一种序列类型。公共序列操作所有序列类型都可以近些某些特定的操作,包括:索引、分片、加、乘、计算序列长度、最大值、最小值等操作。索引序列中的每个元素被分配一个序号,第一个索引为0,第二个为1,依次类推。假定s是一个序列,s[i]即表示是的第
2015-03-27 14:24:24 2112
原创 python3:迭代器
python支持在容器上迭代,通过两个方法实现,允许用户自定义,序列总是支持迭代方法,后面介绍序列的时候会涉及更多的细节。容器中的迭代容器需要定义下面的方法以提供迭代支持:container.__iter__()返回一个迭代器对象,对象要求支持后面介绍的迭代器协议。如果一个容器支持不同类型的迭代,需要提供额外的方法指定请求的迭代器类型(例如一个树结构支持两种迭代方式:广度优先和深度
2015-03-25 15:06:09 3595
原创 python2:数字
python支持3种不同的数字类型:整型、浮点型和复数,布尔类型可以看作整型的子类型。python中的浮点型对应C语言中的double,可以通过sys.float_info来查看精度。数字的基本操作python中的数字都支持下面的操作: 1、x + y:x加y; 2、x - y:x减y; 3、x * y:x和y的积; 4、x / y:x和y的商;
2015-03-24 16:59:23 5659
原创 python1:布尔类型
布尔类型用户在条件或循环中作为条件判断,这里介绍python中的布尔类型。True和Falsepython布尔类型对应两个布尔值:True和False,分别对应1和0。看下面的例子>>> True == 1True>>> False == 0True>>> True + False + 2122布尔表达式的值下面的值在作为布尔表达式时,会被解释器看作Fals
2015-03-23 11:01:59 12979
hadoop-part3
2015-08-04
hadoop-part2
2015-08-04
hadoop-part1
2015-08-04
linux教学课件:Advanced Programming in the Linux Environment
2009-11-09
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人