摘要: def func(*args): return {"max":max(args), "min":min(args)}print(func(1,2,8,9,4,6)) 阅读全文
posted @ 2019-11-06 15:31 冰灬荷 阅读(188) 评论(0) 推荐(0) 编辑
摘要: def func(a): b = 1 for i in range(1,a+1): b = b*i return bprint(func(4)) 阅读全文
posted @ 2019-11-06 15:30 冰灬荷 阅读(135) 评论(0) 推荐(0) 编辑
摘要: def func(): lst= [] lst1 = ["红心", "草花", "黑桃", "方片"] lst2 = ["A", 2, 3, 4, 5, 6, 7, 8, 9, 10, "J", "Q", "K"] for i in lst1: for j in lst2: dic = {} dic 阅读全文
posted @ 2019-11-06 15:29 冰灬荷 阅读(137) 评论(0) 推荐(0) 编辑
摘要: def register(): while 1: import os check = input("退出注册请按Q或q") if check.upper() == "Q": break else: username = input("请输入用户名:") password = input("请输入用户 阅读全文
posted @ 2019-11-01 15:49 冰灬荷 阅读(234) 评论(0) 推荐(0) 编辑
摘要: def func(file, old, new): import os with open(file,mode="r",encoding="utf-8") as f1,\ open("file_副本",mode="w",encoding="utf-8") as f2: for line in f1: 阅读全文
posted @ 2019-10-30 18:53 冰灬荷 阅读(150) 评论(0) 推荐(0) 编辑
摘要: def func( name,age ,edu, gender = "男"): with open("student_msg", mode="a", encoding="utf-8") as f: f.write(name + "_" + gender + "_" + age + "_" + edu 阅读全文
posted @ 2019-10-30 15:23 冰灬荷 阅读(1468) 评论(0) 推荐(0) 编辑
摘要: def lst(list): lst1 = [] for i in range(len(list)): if i %2 ==1: lst1.append(list[i]) return lst1 #return list[1::2] ret = lst([1,2,3,4,5,6,7,8])print 阅读全文
posted @ 2019-06-24 16:15 冰灬荷 阅读(371) 评论(0) 推荐(0) 编辑
摘要: 序号 部门 人数 平均年龄 备注1 python 30 26 单身狗2 Linux 26 30 没对象3 运营部 20 24 女生多 lst = []with open("a1.txt", mode="r", encoding="utf-8") as f: first = f.readline(). 阅读全文
posted @ 2019-06-23 09:42 冰灬荷 阅读(280) 评论(0) 推荐(0) 编辑
摘要: name:apple price:10 amount:3 year:2012name:tesla price:100000 amount:1 year:2013 lst = []with open("a1.txt",mode="r",encoding="utf-8") as f: for line 阅读全文
posted @ 2019-06-23 09:03 冰灬荷 阅读(114) 评论(0) 推荐(0) 编辑
摘要: import oswith open("c",mode="r",encoding="utf-8") as f1 ,\ open("c_副本",mode="w",encoding="utf-8") as f2: for line in f1: f2.write(line.replace("alex", 阅读全文
posted @ 2019-06-22 16:31 冰灬荷 阅读(119) 评论(0) 推荐(0) 编辑