Find a word with a for loop - python
<p>What I'm trying to do is have python go over all the RSS feed titles and make the terminal print out only the titles with a certain word.</p>

<pre><code>import feedparser

d = feedparser.parse('http://rss.cnn.com/rss/edition_technology.rss')

print d['feed']['title']
print 'number of entries:  '
print len(d['entries'])
for post in d.entries:
    print post.title + ": "
</code></pre>

<p>Your code seems great.
What you are missing is an "if" which check if a specific word exists in the post.title</p>

<p>I've used "if" and "in" to filter only the relevant lines.</p>

<p>Details about "in" can be found here: <a href="http://www.jworks.nl/2013/11/07/python-goodness-the-in-keyword/" rel="nofollow">http://www.jworks.nl/2013/11/07/python-goodness-the-in-keyword/</a></p>

<pre><code>myword = "NASA" 

for post in d.entries:
  if myword in post.title:
    print post.title
</code></pre>

python loops parsing rss feed