码迷,mamicode.com
首页 >  
搜索关键字:self    ( 14215个结果
docker-compose安装后执行报错
chmod 751 /usr/bin/docker-compose root用户执行如上命令后切换普通用户然后报错: [22633] Cannot open self /usr/bin/docker-compose or archive /usr/bin/docker-compose.pkg 网上查 ...
分类:其他好文   时间:2020-04-30 09:22:17    阅读次数:69
单例模式
# 类方法 class Foo: __only = None def __init__(self, name): self.name = name @classmethod def get_only(cls, *args, **kwargs): if cls.__only is None: cls. ...
分类:其他好文   时间:2020-04-29 16:40:49    阅读次数:57
leetcode 每日一题 17. 电话号码的字母组合
回溯法 思路: 通过回溯的思维,递归调用枚举出所有可能。 class Solution: def letterCombinations(self, digits): phone = {'2': ['a', 'b', 'c'], '3': ['d', 'e', 'f'], '4': ['g', 'h' ...
分类:其他好文   时间:2020-04-29 12:57:46    阅读次数:64
《AutoInt:基于Multi-Head Self-Attention构造高阶特征》
AutoInt:基于Multi-Head Self-Attention构造高阶特征 本文介绍 2018年 发布在 arXiv 上文章《AutoInt: Automatic Feature Interaction Learning via Self-Attentive Neural Networks》 ...
分类:其他好文   时间:2020-04-29 11:12:43    阅读次数:113
896. 单调数列
1 class Solution(object): 2 def isMonotonic(self, A): 3 """ 4 :type A: List[int] 5 :rtype: bool 6 """ 7 i = 1 8 while i < len(A): 9 if A[i] == A[i - 1 ...
分类:其他好文   时间:2020-04-29 11:01:43    阅读次数:45
985. 查询后的偶数和
代码一:暴力超时。 class Solution(object): # 暴力超时 def sumEvenAfterQueries(self, A, queries): """ :type A: List[int] :type queries: List[List[int]] :rtype: List ...
分类:其他好文   时间:2020-04-29 10:56:55    阅读次数:41
977. 有序数组的平方
代码一: 1 class Solution(object): 2 def sortedSquares(self, A): 3 """ 4 :type A: List[int] 5 :rtype: List[int] 6 """ 7 ans=[] 8 for i in range(len(A)): 9 ...
分类:编程语言   时间:2020-04-29 10:50:17    阅读次数:66
867. 转置矩阵
1 class Solution(object): 2 def transpose(self, A): 3 """ 4 :type A: List[List[int]] 5 :rtype: List[List[int]] 6 """ 7 hang = len(A) 8 lie = len(A[0]) ...
分类:其他好文   时间:2020-04-29 10:45:13    阅读次数:45
python类的定义与使用
为了代码的编写方便简洁,引入了类的定义;一般,使用 class 语句来创建一个新类,class之后为类的名称(通常首字母大写)并以冒号结尾,例如: class Ticket(): def __init__(self,checi,fstation,tstation,fdate,ftime,ttime) ...
分类:编程语言   时间:2020-04-29 01:29:11    阅读次数:129
给类和对象添加成员方法(封装性)
举个例子简单介绍怎么给类和对象添加成员方法 # ### 给类和对象添加成员方法(封装性) class MyClass1: def func1(self): print(">> 成员方法func1") def func2(): print(">> 自定义func2") def func3(obj): ...
分类:其他好文   时间:2020-04-28 23:07:17    阅读次数:125
14215条   上一页 1 ... 86 87 88 89 90 ... 1422 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!