GVKun编程网logo

Python NotImplemented常数(python中常数e)

18

以上就是给各位分享PythonNotImplemented常数,其中也会对python中常数e进行解释,同时本文还将给你拓展2019-02-13Python爬虫问题NotImplementedErro

以上就是给各位分享Python NotImplemented常数,其中也会对python中常数e进行解释,同时本文还将给你拓展2019-02-13 Python爬虫问题 NotImplementedError: Only the following pseudo-classes are implemented: nth...、@Override is not allowed when implementing interface method、An operation is not implemented: not implemented、Android-Could not find method implementation() for arguments等相关知识,如果能碰巧解决你现在面临的问题,别忘了关注本站,现在开始吧!

本文目录一览:

Python NotImplemented常数(python中常数e)

Python NotImplemented常数(python中常数e)

纵览decimal.py,它NotImplemented在许多特殊方法中使用。例如

class A(object):
    def __lt__(self,a):
        return NotImplemented

    def __add__(self,a):
        return NotImplemented

在Python的文件说:

未实现

可以通过“丰富的比较”特殊方法(__eq__()__lt__()和)返回的特殊值,以指示未针对其他类型实现比较。

它没有讨论其他特殊方法,也没有描述行为。

它似乎是一个魔术对象,如果从其他特殊方法返回则引发该对象TypeError,并且在“丰富比较”中特殊方法什么也不做。

例如

print A() < A()

打印True,但是

print A() + 1

提高了TypeError,所以我对正在发生的事情以及NotImplemented的用法/行为感到好奇。

2019-02-13 Python爬虫问题 NotImplementedError: Only the following pseudo-classes are implemented: nth...

2019-02-13 Python爬虫问题 NotImplementedError: Only the following pseudo-classes are implemented: nth...

soup=BeautifulSoup(html.text,''lxml'')
#data=soup.select(''body > div.main > div.ctr > div > div.newsmcont > p:nth-of-type(3) > img'')
#data=soup.select(''body > div.main > div.ctr > div > div.newsmcont > p > img'')[2]
data=soup.select(''body > div.main > div.ctr > div > div.newsmcont > p:nth-child(3) > img'')
print(data)

当使用copy selector时,复制的是nth-child,而soup 似乎不支持nth-child,所以会报以下错误:

NotImplementedError: Only the following pseudo-classes are implemented: nth-of-type.

将nth-child 改为 nth-of-type 就可以了。

或者去掉nth-child,在后面加上[i-1],即[2]。

关于nth-child 和 nth-type,他们都是取父元素下的第n个元素,他们的区别可以通过下面这个例子了解一下:

<div> 
<ul> 
<p>zero</p> 
<li>one</li> 
<li>two</li> 
</ul> 
</div>

上面这个例子,.demo li:nth-child(2)选择的是<li>one</li>节点,.demo li:nth-of-type(2)则选择的是<li>two</li>节点。

@Override is not allowed when implementing interface method

@Override is not allowed when implementing interface method

使用 idea 导入 maven 项目时 会出现如下报错  

@Override 从 jdk1.5 开始出现的,是用来标注方法重写;通常方法重写发生在继承父类,重写父类方法,或者实现接口,实现接口方法;

@Override 能够保证你正确重写方法,当重写方法出错时(方法名误写、漏掉参数)编译器会提示编译错误

1. 问题出在 idea 得 jdk 版本低于 1.5   :File → Project Structure → Modules  把 JDK 版本改成大于 1.5 就可以了

2.pom 文件中配置 maven-compiler-plugin    

<plugin>  
    <groupId>org.apache.maven.plugins</groupId>  
    <artifactId>maven-compiler-plugin</artifactId>  
    <version>3.2</version>  
    <configuration>  
        <source>1.7</source>  
        <target>1.7</target>  
    </configuration>  
</plugin>

 

An operation is not implemented: not implemented

An operation is not implemented: not implemented

最近刚好有点时间,研究了下炒得火热的kotlin

在之前项目中新建了一个module专门用kotlin编程!

项目中数据层和基础库在common module中,都是java,继承了baseActivity和接口IBaseView后,习惯用AS的快捷键自动生成代码。

然后设置下标题栏

强迫症的我这是什么鬼,看了下解释,

父类明明调用了,这里居然无效,不管先运行看看。奈何直接奔掉了。

然后各种搜kotlin继承java抽象类种种,也没啥解决办法,坑啊,还是去看官方文档吧

kotlin TODO 官网描述地址:https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-t-o-d-o.html

Kotlin NotImplementedError 官网描述:https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-not-implemented-error/

然后只想说。CNM。

记得java里面是不用管直接写的,kotlin要删掉该行代码

OK,跑起来了!

 

解决办法:删除

TODO("not implemented") //To change body of created functions use File | Settings | File Templates.

 

Android-Could not find method implementation() for arguments

Android-Could not find method implementation() for arguments

当 AndroidStudio 加载工程的时候:报以下错误:

详细错误:

Could not find method implementation() for arguments [file collection] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

 

在工程的 app/build.gradle 中查看:

 

修改工程的 app/build.gradle,compile - 修改成 --> implementation

【解决此问题的第一步:】

 


 

查看工程的 - build.gradle:

 

 打开一个,在当前电脑,当前 AndroidStudio 正常编译运行 OK 的工程的 build.gradle 文件:

copy  classpath ''com.android.tools.build:gradle:3.2.1''

 

【解决此问题的第二步:】

修改工程的 - build.gradle,为 classpath ''com.android.tools.build:gradle:3.2.1''

 

 

成功解决:

 

 


 

总结解决细节:解决这种类型的错误,一定一定要仔细分析报错的详情 (例如:翻译报错详情),特别要注意的是,报错详情中 有没有提示版本相关的信息,非常重要;

 

总结解决步骤:

为什么要修改 compile 为 implementation:

    implementation 是 gradle 版本 3.0 之后才支持的,出现该问题代表你的 gradle 版本过低。

解决步骤:

  第一步:将 implementation 改为 compile

  第二步:升级 build.gradle 文件中的 Gradle 版本

 

 

 

 

 

 

 

关于Python NotImplemented常数python中常数e的问题我们已经讲解完毕,感谢您的阅读,如果还想了解更多关于2019-02-13 Python爬虫问题 NotImplementedError: Only the following pseudo-classes are implemented: nth...、@Override is not allowed when implementing interface method、An operation is not implemented: not implemented、Android-Could not find method implementation() for arguments等相关内容,可以在本站寻找。

本文标签: