<p>您可以使用<a href="http://packages.python.org/feedparser/introduction.html#parsing-a-feed-from-a-remote-url" rel="nofollow noreferrer">^{<cd1>} module to parse an RSS feed from a given url</a>:</p>
<pre><code>#!/usr/bin/env python
import feedparser # pip install feedparser
d = feedparser.parse('http://feeds.huffingtonpost.com/huffingtonpost/latestnews')
# .. skipped handling http errors, cacheing ..
for e in d.entries:
print(e.title)
print(e.link)
print(e.description)
print("\n") # 2 newlines
</code></pre>
<h3>输出</h3>
<pre><code>Even Critics Of Safety Net Increasingly Depend On It
http://www.huffingtonpost.com/2012/02/12/safety-net-benefits_n_1271867.html
<p>Ki Gulbranson owns a logo apparel shop, deals in
<!-- ... snip ... -->
Christopher Cain, Atlanta Anti-Gay Attack Suspect, Arrested And
Charged With Aggravated Assault And Robbery
http://www.huffingtonpost.com/2012/02/12/atlanta-anti-gay-suspect-christopher-cain-arrested_n_1271811.html
<p>ATLANTA -- Atlanta police have arrested a suspect
<!-- ... snip ... -->
</code></pre>
<p>使用<a href="https://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags">regular expressions to parse rss(xml)</a>可能不是一个好主意。</p>