摘要: class UserInfo(object): passclass Department(object): passclass StarkConfig(object): def __init__(self, num): self.num = num def get_vals(self): v = [ 阅读全文
posted @ 2020-06-10 16:48 冰灬荷 阅读(159) 评论(0) 推荐(0) 编辑
摘要: from types import FunctionTypeimport handlerdef func(arg): """ 判断arg是否可以被调用,如果可以则执行并打印其返回值,否则直接打印结果 :param arg: 传入的参数 :return: """ for item in arg: fu 阅读全文
posted @ 2020-02-24 10:07 冰灬荷 阅读(191) 评论(0) 推荐(0) 编辑
摘要: class School(object): def __init__(self, name): self.name = nameobj1 = School('北京')obj2 = School('上海')obj3 = School('深圳')class Course(object): def __i 阅读全文
posted @ 2020-02-17 11:58 冰灬荷 阅读(182) 评论(0) 推荐(0) 编辑
摘要: class Page: def __init__(self, data_list, page_num, page_sum=10): self.data_list = data_list self.page_num = page_num self.page_sum = page_sum @proper 阅读全文
posted @ 2020-02-17 10:30 冰灬荷 阅读(120) 评论(0) 推荐(0) 编辑
摘要: class User: def __init__(self, name, pwd): self.name = name self.pwd = pwdclass Account: def __init__(self): self.user_list = [] # 用户列表,数据格式: 【User对象, 阅读全文
posted @ 2020-02-15 17:03 冰灬荷 阅读(314) 评论(0) 推荐(0) 编辑
摘要: import reuser_list = []while True: if len(user_list) < 3: user = input('请输入用户名:') pwd = input('请输入密码:') email = input('请输入邮箱:') check_email = re.compi 阅读全文
posted @ 2020-02-15 15:19 冰灬荷 阅读(225) 评论(0) 推荐(0) 编辑
摘要: import res = '2-1*-22-3-4/-5'def result_small( s ): # 计算乘除 if '*' in s: a, b = s.split('*') return float(a)*float(b) elif '/' in s: a, b = s.split('/' 阅读全文
posted @ 2020-02-08 09:36 冰灬荷 阅读(155) 评论(0) 推荐(0) 编辑
摘要: 方法一:import randomdef red_pack(money, num): money = money*100 lst = random.sample(range(money), num-1) lst.sort() lst.insert(0, 0) lst.append(money) pr 阅读全文
posted @ 2020-02-04 10:59 冰灬荷 阅读(108) 评论(0) 推荐(0) 编辑
摘要: import pickledef register(): close = input("退出请按Q\q:") if close.upper() == "Q": return else: dic = {} user_name = input('请输入注册的用户名:') user_password = 阅读全文
posted @ 2020-02-03 15:32 冰灬荷 阅读(200) 评论(0) 推荐(0) 编辑
摘要: import osdef copy(path1, path2): filename = os.path.basename(path1) if os.path.isdir(path2) and os.path.isfile(path1): path2 = os.path.join(path2, fil 阅读全文
posted @ 2020-02-03 12:00 冰灬荷 阅读(176) 评论(0) 推荐(0) 编辑