You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
from parsel import Selector
html = "<h3>吉林大学社会科学学报<p>Jilin University Journal Social Sciences Edition</p></h3>"
sel = Selector(html)
print(sel.css("h3"))
print(sel.css("h3 > p::text").getall())
from parsel import Selector
html = "<h3>吉林大学社会科学学报<em>Jilin University Journal Social Sciences Edition</em></h3>"
sel = Selector(html)
print(sel.css("h3"))
print(sel.css("h3 > em::text").getall())
结果:
[<Selector xpath='descendant-or-self::h3' data='<h3>吉林大学社会科学学报<em>Jilin University Jo...'>]
['Jilin University Journal Social Sciences Edition']
The text was updated successfully, but these errors were encountered:
I don’t think Parsel intends to require that input HTML is standard-compliant. Ideally, anything that a browser accepts we should accept as well, because HTML documents in the wild care about browser support more than they care about standard compliance.
当我使用css选择器时 无法获取h3下的p标签,结果如下:
当我将p标签换成其他标签时可以正常获取:
结果:
The text was updated successfully, but these errors were encountered: