python - 查找 pyquery 对象的标签名称

标签 python object tags pyquery

for l in d.items('nl,de,en'):
   if l.tag()=='nl':
      dothis()

如何找到与 pyquery 对象关联的标签?方法 tag() 在 上面的例子不存在...

最佳答案

获取标签名称的正确方法是使用 is_() 函数。

for l in d.items('nl,de,en'):
   if l.is_('nl')
      dothis()

来自文档: https://pythonhosted.org/pyquery/modules/pyquery/pyquery.html#PyQuery.is

希望对您有所帮助。

关于python - 查找 pyquery 对象的标签名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28128104/

相关文章:

java - 使用循环创建待定数量的对象

docker - 如何在 docker-compose 中使用多个图像标签

android - 访问超过 2kbytes 的 NFC 标签内存

python - 如何为 jupyterhub 配置启动脚本?

python - 暴力最接近配对算法 - for 循环

C++ Stack 实现意外输出

python - 是否可以使用 emacs 使 Python etags 更智能一些?

python - 尝试实现非阻塞 python tcp 多个端口出现奇怪的异常

python - 如何在 python/json 中的输入数据之间插入数据?

C++ 对象引用