tuple.set集合,dict

摘要: 1.tuple是有序的.有count方法进行计数元素 tu1 = [1,2,3] tu1.count(2) tu1.index(3) 2.set和dict是无序的,无序的就说明无法通过索引进行元素查找 3.set没有重复的元素,有两种方式设置集合 a = set([2,3,4]) b = {3,2, 阅读全文
posted @ 2017-05-25 21:22 潇米测媛 阅读(60) 评论(0) 推荐(0)

数据类型-2-20170510

摘要: 占位符 1.%s,对字符串进行占位 a = 'hello' 'my name is %s' % a 'my name is %(b)s ' %({'b':a}) 2.%f浮点数 %m.nf %34 m表示总的位数,n为小数点 %f %43 如果这样的话,就会有固定的小数个数 %-10.4f % 3. 阅读全文
posted @ 2017-05-10 21:59 潇米测媛 阅读(68) 评论(0) 推荐(0)

数据类型-1 -0509

摘要: 1.字符串的方法。既然是字符串,那肯定有引号 a = 'avd vdv' a.count('v') #计算v的数目,在a中 a.find('v') 查找v的位置,不存在的返回-1,存在的返回int型,可以指定位置,help(str.find) a.index('v')查找v的位置,不存在返回报错,两 阅读全文
posted @ 2017-05-09 22:00 潇米测媛 阅读(93) 评论(0) 推荐(0)

特殊方法-0505-2017

摘要: #特殊方法class Rectangle(): def __init__(self,width,height): self.width = width self.height = height #def __str__(self): #print调用方法 #return'宽%s,高%s'%(self 阅读全文
posted @ 2017-05-05 22:09 潇米测媛 阅读(60) 评论(0) 推荐(0)

特殊方法

摘要: #特殊方法class Rectangle(): def __init__(self,width,height): self.width = width self.height = height #def __str__(self): #print调用方法 #return'宽%s,高%s'%(self 阅读全文
posted @ 2017-05-04 22:48 潇米测媛 阅读(91) 评论(0) 推荐(0)

python 学习-基础-2017-05-04

摘要: 第二节 idle 名字和对象 唯一的标示符 id 类型 通过查type 内容 keyword.kwist()查看关键字 len(keyword.kwist) keyword.iskeyword(‘str’) Def func(): Return x * y Print(func()) 对a.appe 阅读全文
posted @ 2017-05-04 22:01 潇米测媛 阅读(90) 评论(0) 推荐(0)