随笔分类 -  python

摘要:参考链接 Python 3.x | 史上最详解的 导入(import) 解决python3中关于import的疑难杂症 阅读全文
posted @ 2022-02-20 00:24 dvlk1 阅读(29) 评论(0) 推荐(0)
摘要:0x00 staticmethod和classmethod区别 class A(object): def foo(self, x): print(f"executing foo({self}, {x})") @classmethod def class_foo(cls, x): print(f"ex 阅读全文
posted @ 2022-02-19 20:49 dvlk1 阅读(83) 评论(0) 推荐(0)
摘要:1. 易混淆操作 本节对一些 Python 易混淆的操作进行对比。 1.1 有放回随机采样和无放回随机采样 import randomrandom.choices(seq, k=1) # 长度为k的list,有放回采样random.sample(seq, k) # 长度为k的list,无放回采样 1 阅读全文
posted @ 2022-01-17 09:15 dvlk1 阅读(66) 评论(0) 推荐(0)