.. link: http://dgplug.org/summertraining/2013/posts/rahulc93-planetfeedparser-20130718-055654.html .. description: .. tags: .. date: 2013/07/18 05:56:54 .. title: rahulc93 planetfeedparser 20130718-055654 .. slug: rahulc93-planetfeedparser-20130718-055654 planetfeedparser ================ In this assignment, we will be reading the RSS feeds of this `site `_ , parse the feed, and print the title of the blog posts and their respective authors. Source Code ----------- The code for the above problem can be found `here `_ Solution -------- The solution to the problem is shown below. .. code:: python #!/usr/bin/env python import feedparser feed = feedparser.parse("http://planet.fedoraproject.org/rss20.xml") # parsing the feed from the recquired URL for x in range(len(feed.entries)): # iterating throgh the items in the entries list author, title = feed.entries[x].title.split(":", 1) # extracting the names of authors and titles from the list print "\nAuthor: ", author, "\nTitle: ", title # printing the information obtained Run the program --------------- To run this script, save the file as *planetfeedparser.py*, and follow the steps. 1. Change the file's permissions and make it executable:: $ chmod +x planetfeedparser.py 2. Execute the file:: $ ./planetfeedparser.py *Alternatively*, you can try:: $ python planetfeedparser.py