摘要: Python 有多种内置数据类型。以下是比较重要的一些:Booleans[布尔型] 或为 True[真] 或为 False[假]。Numbers[数值型] 可以是 Integers[整数](1 和 2)、Floats[浮点数](1.1 和 1.2)、Fractions[分数](1/2 和 2/3)、甚至是 Complex Number[复数]。Strings[字符串型] 是 Unicode 字符序列,例如: 一份 html 文档。Bytes[字节] 和 Byte Arrays[字节数组], 例如: 一份 jpeg 图像文件。Lists[列表] 是值的有序序列。Tuples[元组] 是有序而不可 阅读全文
posted @ 2012-08-21 23:40 linzj 阅读(2186) 评论(0) 推荐(0) 编辑
摘要: #filename:randNumber.pyimport randomwhile True: try: row=int(raw_input('Enter the rows:')) cols=int(raw_input('then Enter the cols:')) minNum=int(raw_input('then Enter the minNumber:')) maxNum=int(raw_input('then Enter the maxNumber:')) r=0 while... 阅读全文
posted @ 2012-08-21 23:25 linzj 阅读(992) 评论(0) 推荐(0) 编辑
摘要: 类型转换: 1 #Code: 2 int(x [,base ]) 将x转换为一个整数 3 long(x [,base ]) 将x转换为一个长整数 4 float(x ) 将x转换到一个浮点数 5 complex(real [,imag ]) 创建一个复数 6 str(x ) 将对象 x 转换为字符串 7 repr(x ) 将对象 x 转换为表达式字符串 8 eval(str ) 用来计算在字符串中的有效Python表达式,并返回一个对象 9 tup... 阅读全文
posted @ 2012-08-21 23:13 linzj 阅读(760) 评论(0) 推荐(0) 编辑
摘要: #filename:bigNumber.pyzero=['*******','* *','* *','* *','* *','* *','*******']one=[' *',' *',' *',' *',' *',' *',' *']two=['*******',' *',' *','*******', 阅读全文
posted @ 2012-08-21 23:07 linzj 阅读(537) 评论(0) 推荐(0) 编辑