上一页 1 ··· 3 4 5 6 7
摘要: 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 阅读(223) 评论(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 阅读(225) 评论(0) 推荐(0)
摘要: def gen(name): while 1: print(f'{name} ready to ea') food = yield 666#print(next(dog)) #print(dog.send('骨头2')) # print(dog.send('骨头4')) food1 = yield 阅读全文
posted @ 2020-06-16 18:51 diracy 阅读(190) 评论(0) 推荐(0)
摘要: 优先级:( )>not>and>or x or y x为真,值就是x,x为假,值是y; x and y x为真,值是y,x为假,值是x。 三元运算符: a if a>b else b ASCII: 英文: 8位,1个字节表示. GBK: 英文: 8位,1个字节表示. 中文: 16位,两个字节表示. 阅读全文
posted @ 2020-06-16 09:49 diracy 阅读(147) 评论(0) 推荐(0)
摘要: import osstate=0name=""def wrapper(f): def inner(*args,**kwargs): if state==1: ret=f(*args,**kwargs) wel=ret[:3]+name+ret[3:] print(wel) return ret el 阅读全文
posted @ 2020-06-14 22:32 diracy 阅读(158) 评论(0) 推荐(0)
摘要: # 商品信息在文件存储的,存储形式:# name price# 电脑 1999# 鼠标 10# 游艇 20# 美女 998# 1,用户先给自己的账户充钱:比如先充3000元。# 2,读取商品信息文件将文件中的数据转化成下面的格式:# goods = [{"name": "电脑", "price": 阅读全文
posted @ 2020-06-14 15:39 diracy 阅读(200) 评论(0) 推荐(0)
摘要: # 将list3 这种数据类型转化成list4类型list3 = [{"name": "a", "hobby": "抽烟"},{"name": "a", "hobby": "喝酒"},{"name": "a", "hobby": "烫头"},{"name": "a", "hobby": " 阅读全文
posted @ 2020-06-14 15:35 diracy 阅读(98) 评论(0) 推荐(0)
上一页 1 ··· 3 4 5 6 7