【发布时间】:2014-06-07 03:14:58
【问题描述】:
我正在尝试获取 dl 元素的类。我可以打印课程(见第一行),但我不能在 if 语句中使用该结果(所以永远不会打印“作品”)。 我想我的语法有点错误。我是吗? 相信我,我的测试中有很多“方法”类元素 - 见下文
print(child.dl.get('class'))
if child.dl.get('class')=="['method']":
print("WORKS!")
这是第一行的输出:
['method']
['method']
['class']
['method']
['method']
['method']
['method']
['describe']
【问题讨论】:
标签: python html python-3.x html-parsing beautifulsoup