擅长:python、mysql、java
<p>显然,news()方法不返回任何内容。。你知道吗</p>
<p>正确的方法应该是:</p>
<pre><code>def news():
YahooContent = feedparser.parse ("http://news.yahoo.com/rss/")
result = ''
for feed in YahooContent.entries:
result += feed.published + '\n'
result += feed.title + '\n'
result += feed.link + "\n"
return result
def html(request):
html = "<html><body> %s </body></html>" % news()
return HttpResponse(html)
</code></pre>