![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python
文章平均质量分 52
芦边湖泊
这个作者很懒,什么都没留下…
展开
-
pytorch-lightning浅踩坑记录
pytorch lightning原创 2022-08-30 18:15:01 · 1049 阅读 · 1 评论 -
Iterable Unpacking 迭代解包
Python allows a tuple (or list) of variables to appear on the left side of an assignment operation. Each variable in the tuple can receive one value (or more, if we use the * operator) from an iterable on the right side of the assignment. The * is the ite.原创 2021-08-24 16:27:06 · 387 阅读 · 0 评论 -
Python中staticmethod和classmethod的区别
class A(object): def m1(self): print("实例方法") @classmethod def m2(cls,n): print('class method', n) @staticmethod def m3(m): print('static method', n)调用:类方法和静态方法都用可以通过类名和实例名调用,因此可以在普通实例方法中使用self.m2(n) self.m3(n)来调用.【区别】class method与class绑定,s转载 2021-08-17 19:47:13 · 383 阅读 · 0 评论 -
python 生成器
在Python中,一边循环一边计算的机制,称为生成器(generator)。1. 把列表生成式的[]改成()>>>[x for x in range(5)][0, 1, 2, 3, 4]>>>(x for x in range(5))<generator object <genexpr> at 0x109a9a6d0>2. 调用生成器generator保存的是算法,变成generator的函数g,在每次调用next(g)的时候执行,原创 2021-08-04 16:47:47 · 60 阅读 · 0 评论