在IDE中使用lxml,代码完成/自动完成

Sco*_*ott 4 python lxml pydev pycharm

我试图使用LXML在pycharm或使用的PyDev日食,一切正常,除了代码完成,这似乎是不存在的.我需要实现一些东西来使它与lxml中的类一起工作吗?

例如:

import lxml.html
html = open('html.html', 'r').read()

root = lxml.html.fromstring(html)
tds = root.cssselect("td.author")

print temp[0].text # I know that the text attribute exists but code completion doesn't show it
Run Code Online (Sandbox Code Playgroud)

注意:Intelisense和智能帮助适用于其他事情而不是lxml.

Kie*_*ong 6

这通常是使用C语言编写的模块的问题lxml,其中大多数解析器只能获取方法的签名而不能获取详细信息.python方法的签名没有返回类型,因此很难猜测它的类型tds.缺乏信息会导致自动完成功能失败.

除了等待IDE的作者改进他们的解析器之外,你无能为力.