摘要: class test(object): flog = None flog1 = False def __new__(cls, *args, **kwargs): if cls.flog is None: cls.flog = super().__new__(cls) return cls.flog def... 阅读全文
posted @ 2019-04-10 16:22 xusuns 阅读(97) 评论(0) 推荐(0) 编辑
摘要: class Game(): # 这是个类属性 top_fen = 0 @classmethod # 这是类方法 def show_top_fen(cls): print("最高分是%d,这是个类方法" % cls.top_fen) @staticmethod # 这是个静态方法 def show_help(): ... 阅读全文
posted @ 2019-04-07 10:22 xusuns 阅读(127) 评论(0) 推荐(0) 编辑
摘要: class Gun(): def __init__(self, gun_name, bullet=0): self.gun_name = gun_name self.bullet = bullet def __str__(self): return "[%s]子弹数[%d]" % (self.gun_name, self.bull... 阅读全文
posted @ 2019-03-31 12:10 xusuns 阅读(122) 评论(0) 推荐(0) 编辑
摘要: 学习笔记,做一个添加家具的操作 阅读全文
posted @ 2019-03-29 15:51 xusuns 阅读(168) 评论(0) 推荐(0) 编辑
摘要: 主页分为四个板块:原创软件,精品软件,灌水专区,福利专区。原创软件,精品软件可以浏览,灌水专区,福利专区需要登陆后浏览,支持qq登陆和本地登陆两种方式,用户系统支持增删改查功能(学习完正则之后再修改),需要留用户名密码手机三个 选项。 阅读全文
posted @ 2018-03-12 15:33 xusuns 阅读(298) 评论(0) 推荐(0) 编辑
摘要: def f(max): n, a, b = 0, 0, 1 while n <= max: yield b a, b = b, a + b n += 1 yield 'done' for i in f(5): print(i) 阅读全文
posted @ 2018-02-27 10:52 xusuns 阅读(359) 评论(0) 推荐(0) 编辑
摘要: def bett(f): def inner(): print('123') f() print('hello') return inner @bett def f(): print('abc') f() 阅读全文
posted @ 2018-02-14 21:28 xusuns 阅读(72) 评论(0) 推荐(0) 编辑
摘要: def register(NAME, PWD, TEL): with open('userdate.txt', 'a', encoding='utf-8') as f: new = '&&'.join([NAME, PWD, TEL]) f.write('\n' + str(new)) return True def same(NAME): ... 阅读全文
posted @ 2018-02-06 14:35 xusuns 阅读(171) 评论(0) 推荐(0) 编辑
摘要: def register(name, pwd, tel): with open('userdate.txt', 'a', encoding='utf-8') as f: new = {} new[name] = [pwd,tel] f.write('\n' + str(new)) return True def same... 阅读全文
posted @ 2018-02-04 10:34 xusuns 阅读(221) 评论(0) 推荐(0) 编辑
摘要: a = [18, 33, 98, 5, 2, 7, 2, 1] for i in range(len(a) - 1): # 总比对轮数,最后一次不用比对 for j in range(len(a) - i - 1): # 每轮的比对次数,已经比对过的不用再次比对 if a[j] < a[j + 1]: # 如果满足条件(前一个数大) a[j]... 阅读全文
posted @ 2018-01-31 15:53 xusuns 阅读(99) 评论(0) 推荐(0) 编辑