摘要: class A: def func(self):print('a') class B(A): def func(self):print('b') b = B() b.func() # b 自己有不用父类的 class A: def func(self):print('a') class B(A):p 阅读全文
posted @ 2020-08-04 15:57 diracy 阅读(120) 评论(0) 推荐(0)
摘要: import pickleclass Foo: def __init__(self): self.l=[] def get(self, key): self.l.append(key) def put(self): print(self.l.pop()) if self.index 1 else p 阅读全文
posted @ 2020-07-31 06:18 diracy 阅读(130) 评论(0) 推荐(0)
摘要: import sysdef get_register(): li_info=[] with open('register',encoding='utf-8',mode="r") as f: for i in f: li_personal = {} li_personal["id"]=i.strip( 阅读全文
posted @ 2020-07-30 10:50 diracy 阅读(281) 评论(0) 推荐(0)
摘要: 文件存储格式如下:id,name,age,phone,job1,Alex,22,13651054608,IT2,Egon,23,13304320533,Tearcher3,nezha,25,1333235322,IT 现在需要对这个员工信息文件进行增删改查。基础必做:a.可以进行查询,支持三种语法: 阅读全文
posted @ 2020-07-29 23:21 diracy 阅读(162) 评论(0) 推荐(0)
摘要: s='1-2*((60-30+(-40/5)*(9-2*5/3+7/3*99/4*2998+10*568/14))-(-4*3)/(16-3*2))'def cacular(s): import re def division(a, b): return float(a) / float(b) de 阅读全文
posted @ 2020-07-28 15:03 diracy 阅读(196) 评论(0) 推荐(0)
摘要: # 定义一个用户类,用户名和密码是这个类的属性,实例化两个用户,分别有不同的用户名和密码 # 登陆成功之后才创建用户对象 # 设计一个方法 修改密码import osdef login(name,passwd,filepath = 'userinfo'): with open(filepath,en 阅读全文
posted @ 2020-07-26 12:04 diracy 阅读(154) 评论(0) 推荐(0)
摘要: import osimport sysimport shutilif len(sys.argv) >= 5: if sys.argv[1] =='zlz' and sys.argv[2] == '666': if sys.argv[3] == 'cp' and len(sys.argv) == 6: 阅读全文
posted @ 2020-07-26 10:44 diracy 阅读(181) 评论(0) 推荐(0)
摘要: import reclass Person: def __init__(self,name,gendder,id): self.name=name self.gender=gendder self.id=id def age(self): ret=re.search('\d{6}(?P<birthy 阅读全文
posted @ 2020-07-24 16:58 diracy 阅读(133) 评论(0) 推荐(0)
摘要: li=[i for i in range(10000000)]s=23000def compare(start=0,end=len(li),now=len(li)//2): if li[start]<s<li[now]: end = now now=(now+start)//2 start=star 阅读全文
posted @ 2020-07-24 13:23 diracy 阅读(617) 评论(0) 推荐(0)
摘要: menu = { '北京': { '海淀': { '五道口': { 'soho': {}, '网易': {}, 'google': {} }, '中关村': { '爱奇艺': {}, '汽车之家': {}, 'youku': {}, }, '上地': { '百度': {}, }, }, '昌平': 阅读全文
posted @ 2020-07-19 10:53 diracy 阅读(132) 评论(0) 推荐(0)