接頭辞がある場合を除いて、私はタグを読むことができます。私は前の質問のためにSOを捜しているわけではありません。接頭辞のタグ付き解析.xml? xml.etree.ElementTree
私はmedia:content
を読む必要があります。私はimage = node.find("media:content")
を試しました。 のRss入力:
<channel>
<title>Popular Photography in the last 1 week</title>
<item>
<title>foo</title>
<media:category label="Miscellaneous">photography/misc</media:category>
<media:content url="http://foo.com/1.jpg" height="375" width="500" medium="image"/>
</item>
<item> ... </item>
</channel>
私は兄弟タグtitle
を読むことができます。
from xml.etree import ElementTree
with open('cache1.rss', 'rt') as f:
tree = ElementTree.parse(f)
for node in tree.findall('.//channel/item'):
title = node.find("title").text
私は、ドキュメントを使用して、まだ「プレフィックス」の部分に貼り付けてきました。