gpt4 book ai didi

python - 在具有代码完成/自动完成功能的 IDE 中使用 lxml

转载 作者:太空狗 更新时间:2023-10-30 02:34:11 27 4
gpt4 key购买 nike

我正在尝试在 pycharm 中使用 lxml 或使用 pydev 在 eclipse 中使用,一切正常,除了代码完成,它似乎不存在。是否需要执行某些操作才能使其与 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

注意:Intelisense 和 smart help 只适用于 lxml 以外的其他东西。

最佳答案

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

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

关于python - 在具有代码完成/自动完成功能的 IDE 中使用 lxml,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9711384/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com