1 回答
TA贡献1827条经验 获得超9个赞
另一种方法。
from simplified_scrapy import SimplifiedDoc
xml = '''<item>
<title>Defensive Moves</title>
<link>www.timmy256.wordpress.com</link>
<pubDate></pubDate>
<dc:creator><![CDATA[jross]]></dc:creator>
<guid isPermaLink="false"> www.timmy256.wordpress.com </guid>
<description></description>
<content:encoded><![CDATA[I love playing basketball and eating food.]]></content:encoded>
</item>'''
doc = SimplifiedDoc(xml)
print(doc.select('item>content:encoded>html()')[9:-3])
结果:
I love playing basketball and eating food.
这里有更多例子:https ://github.com/yiyedata/simplified-scrapy-demo/tree/master/doc_examples
添加回答
举报