摘要: class Foo: def __init__(self, x): self.x = x print(Foo) def __init__(self,x): self.x = x FFo = type('FFo',(object,), {'__init__': __init__}) print(FFo) print(FFo.__dict__) f = ... 阅读全文
posted @ 2019-01-14 22:25 我爱敲代码 阅读(108) 评论(0) 推荐(0)
摘要: class Lazyproperty: def __init__(self, func): self.func = func def __get__(self, instance, owner): print('get') # print(instance) # print(owner) if instance i... 阅读全文
posted @ 2019-01-11 16:25 我爱敲代码 阅读(109) 评论(0) 推荐(0)
摘要: class Type: def __init__(self, key, expect_type): self.key = key self.expect_type = expect_type def __get__(self, instance, owner): print('执行get方法') return in... 阅读全文
posted @ 2019-01-10 09:51 我爱敲代码 阅读(158) 评论(0) 推荐(0)
摘要: import timeclass Foo: x = 1 def __init__(self, y): self.y = y def __getattr__(self, item): # 没有的情况下调用此方法 print(item) def __setattr__(self, key, value): self.__dict_... 阅读全文
posted @ 2019-01-02 20:06 我爱敲代码 阅读(220) 评论(0) 推荐(0)
摘要: def judge_password(password): if len(password) >= 8: pattern = re.compile('[A-Z]+') match = pattern.findall(password) if match: pattern = re.compile('[a-z]+') ... 阅读全文
posted @ 2018-12-29 22:33 我爱敲代码 阅读(7621) 评论(0) 推荐(0)
摘要: yum -y install mariadb mariadb-server systemctl start mariadb #设置开机启动 systemctl enable mariadb # 简单相关配置 mysql_secure_installation # 详情请参考https://www.cnblogs.com/zhanzhan/p/7729981.html 阅读全文
posted @ 2018-12-25 11:34 我爱敲代码 阅读(122) 评论(0) 推荐(0)
摘要: vim /etc/resolv.conf nameserver 119.29.29.29 nameserver 182.254.116.116 nameserver 8.8.8.8 阅读全文
posted @ 2018-12-25 11:11 我爱敲代码 阅读(668) 评论(0) 推荐(0)
摘要: msg = '\033[41;1m字符串内容\033[0m' print(msg) # \033[41;1m起始位置 改变41数值就是改变其他颜色,、033[0m 结束位置 阅读全文
posted @ 2018-12-23 16:46 我爱敲代码 阅读(723) 评论(0) 推荐(0)
摘要: test = 'alEx' print(test.capitalize()) # 首字母大写 其他都变小写 print(test.casefold()) # 变小写 更牛逼 print(test.lower()) # 全部变小写 print(test.center(20, '*')) # 设置宽度,一共20个位置,将test放中间,其他用*拼接 print(test.count... 阅读全文
posted @ 2018-12-17 09:35 我爱敲代码 阅读(183) 评论(0) 推荐(0)
摘要: import sys import time # print(sys.argv) for i in range(100): # 进度条 sys.stdout.write('#') time.sleep(0.1) sys.stdout.flush() 阅读全文
posted @ 2018-12-15 13:29 我爱敲代码 阅读(78) 评论(0) 推荐(0)