04 2018 档案

摘要:#coding=utf-8#类和对象皆可访问静态字段和静态方法,我的理解是:方法后加了self的,类都不能访问class Person: sex='male' #静态字段def __init__(self,name,age,salary): #self属于对象,self 代表下方的p1,不属于类 s 阅读全文
posted @ 2018-04-20 19:59 hyy0927 阅读(82) 评论(0) 推荐(0) 编辑
摘要:#coding=utf-8#给列表加上序号,enumerate(l1),默认从0开始l1=['money','house','joo']for item in enumerate(l1,1): #print item print item[0],item[1] 阅读全文
posted @ 2018-04-20 19:52 hyy0927 阅读(131) 评论(0) 推荐(0) 编辑
摘要:#coding=utf-8方法一import random checkcode=''for i in range(4): #0,1,2,3 current=random.randrange(0,4) if current !=i: temp=chr(random.randint(65,90)) #6 阅读全文
posted @ 2018-04-20 19:46 hyy0927 阅读(111) 评论(0) 推荐(0) 编辑