07 2020 档案

摘要: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 阅读(133) 评论(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 阅读(282) 评论(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 阅读(197) 评论(0) 推荐(0)
摘要:# 定义一个用户类,用户名和密码是这个类的属性,实例化两个用户,分别有不同的用户名和密码 # 登陆成功之后才创建用户对象 # 设计一个方法 修改密码import osdef login(name,passwd,filepath = 'userinfo'): with open(filepath,en 阅读全文
posted @ 2020-07-26 12:04 diracy 阅读(155) 评论(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 阅读(183) 评论(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 阅读(134) 评论(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 阅读(621) 评论(0) 推荐(0)
摘要:menu = { '北京': { '海淀': { '五道口': { 'soho': {}, '网易': {}, 'google': {} }, '中关村': { '爱奇艺': {}, '汽车之家': {}, 'youku': {}, }, '上地': { '百度': {}, }, }, '昌平': 阅读全文
posted @ 2020-07-19 10:53 diracy 阅读(133) 评论(0) 推荐(0)
摘要:import osdef get_size(path): name_list=os.listdir(path) totalsize=0 num_file = 0 num_dir=0 for name in name_list: size=0 abs_path=os.path.join(path,na 阅读全文
posted @ 2020-07-17 14:33 diracy 阅读(224) 评论(0) 推荐(0)
摘要:'''#def fib(n,a=1,b=1): if n==1 or n==2: return b elif n>=2: a,b=b,a+b return fib(n-1,a,b)ret=fib(10)print(ret)''''''#def fib(n): a,b=(1,1) while n>2: 阅读全文
posted @ 2020-07-14 09:48 diracy 阅读(123) 评论(0) 推荐(0)
摘要:import osdef show_file(path): name_list=os.listdir(path) s=0 for name in name_list: abs_path=os.path.join(path,name) if os.path.isfile(abs_path): prin 阅读全文
posted @ 2020-07-14 09:47 diracy 阅读(226) 评论(0) 推荐(0)