05 2021 档案

摘要:from math import pi class Circle(object): def __init__(self,radius): self.radius = radius def getRadius(self): return self.radius def setRadius(self, 阅读全文
posted @ 2021-05-19 15:29 ty1539 阅读(52) 评论(0) 推荐(0) 编辑
摘要:#_*_ encoding: utf-8 _*_ @author: ty hery 2019/7/17 import sys import inspect class testsqawd(object): def hello(self): print('the name of method is # 阅读全文
posted @ 2021-05-19 15:15 ty1539 阅读(61) 评论(0) 推荐(0) 编辑
摘要:就是把自己定义的函数装饰一遍,在原来函数的基础上做些其他操作,然后返回一个新的函数,调用名称是一样的,只是内容稍有变化(注意是新的,已经不是本来定义的函数了,但是原来的函数最终还是会在装饰器最内层返回的,只是返回时添加了些东西,比如逻辑判断,打印,往哪个列表添加东西等等操作,比如在原来函数功能的基础 阅读全文
posted @ 2021-05-19 09:27 ty1539 阅读(48) 评论(0) 推荐(0) 编辑
摘要:class A: def test(self): print('print from A') pass class B(A): # def test(self): # print('print from B') pass class C(A): def test(self): print('prin 阅读全文
posted @ 2021-05-13 15:06 ty1539 阅读(63) 评论(0) 推荐(0) 编辑
摘要:file.seek()方法标准格式是:seek(offset,whence=0)offset:开始的偏移量,也就是代表需要移动偏移的字节数, whence:给offset参数一个定义,表示要从哪个位置开始偏移;0代表从文件开头开始算起,1代表从当前位置开始算起,2代表从文件末尾算起。默认为0 whe 阅读全文
posted @ 2021-05-13 10:13 ty1539 阅读(510) 评论(0) 推荐(0) 编辑
摘要:![](https://img2020.cnblogs.com/blog/1304933/202105/1304933-20210508162131268-263565287.png) ![](https://img2020.cnblogs.com/blog/1304933/202105/1304933-20210508171712400-1142812774.png) 阅读全文
posted @ 2021-05-12 09:34 ty1539 阅读(39) 评论(0) 推荐(0) 编辑
摘要:1. import() test.py里面 def say_hi(): print('hello') module_name='test' m =__import__(module_name) m.say_hi() 输出: hello 2. locals()和vars() msg=123 def t 阅读全文
posted @ 2021-05-10 15:07 ty1539 阅读(110) 评论(0) 推荐(0) 编辑
摘要:实验中用的 init.py 15 35 80 def read_visits(data_path): with open(data_path) as f: for line in f: yield int(line) def normalize_copy(numbers): numbers = li 阅读全文
posted @ 2021-05-07 11:36 ty1539 阅读(38) 评论(0) 推荐(0) 编辑
摘要:1.验证长字符串空格 def index_words(text): result = [] if text: result.append(0) for index, letter in enumerate(text): if letter ==' ': result.append(index+1) 阅读全文
posted @ 2021-05-06 23:44 ty1539 阅读(33) 评论(0) 推荐(0) 编辑
摘要:假如有一份列表,其中的元素都是数字,现在要对其排序,但排序时,要把出现在 某个群组内的数字,放在群组外的那些数字之前。这种用法在绘制用户界面时候可能会 遇到,我们可以用这个办法把重要的消息或意外的事件优先显示在其他内容前面。 实现该功能的一种常见做法,是在调用列表的sort方法时,把辅助函数传给ke 阅读全文
posted @ 2021-05-06 23:07 ty1539 阅读(25) 评论(0) 推荐(0) 编辑
摘要:设置自动启动并且启动postgresql服务 systemctl enable postgresql-10 systemctl start postgresql-10 su - postgres 进入postgres用户 su - postgres : 进入postgres, 记住尽量用 - 的方式 阅读全文
posted @ 2021-05-06 19:38 ty1539 阅读(243) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示