Hi All ,
I tried this simple code using 'feed parser'. May be you will find it
useful.
Am new to Python,any suggestions or new ideas on how we can improve this
code.

-Avinash



_______________________________________________________________________________________
*
*
*Program : *

#! /usr/bin/python
import feedparser

BBCCricketNews = feedparser.parse('
http://newsrss.bbc.co.uk/rss/sportplayer_uk_edition/cricket/rss.xml')
CricinfoCricketNews = feedparser.parse('
http://www.cricinfo.com/rss/content/story/feeds/0.rss')

X= input('BBC Cricket News:1 , Cricinfo Cricket News:2 \n enter your choice:
')
i=1

if X==1:
  print "BBC Cricket news"
  while i <= 5:
        ptitle =  BBCCricketNews.entries[i].title
        pdes=BBCCricketNews.entries[i].description
        purl=BBCCricketNews.entries[i].link
        print '%s.%s' %(i,a)
        print '%s' %(purl)
        print '%s' %(pdes)
        print '\n'
        i +=1

elif X==2:
  print "Cricinfo Cricket news"
  while i <= 5:
        ptitle=CricinfoCricketNews.entries[i].title
        pdes=CricinfoCricketNews.entries[i].description
        purl=CricinfoCricketNews.entries[i].link
        print '%s.%s' %(i,a)
        print '%s' %(purl)
        print '%s' %(pdes)
        print '\n'
        i +=1
----------------------------------------------------------------------------------------------------------------------------------
*Sample output 1:*
avin...@linux-qqbq:~/pyPrograms> ./LatestCricketNews.py
BBC Cricket News:1 , Cricinfo Cricket News:2
 enter your choice: 1
BBC Cricket news
1.Swann thrilled by 'dream' Ashes tour
http://news.bbc.co.uk/go/rss/-/sport1/hi/cricket/9028868.stm
Graeme Swann tells BBC Sport that a childhood dream has been realised after
being named as part of England's squad for this winter's Ashes series in
Australia.


2.Miller explains Ashes squad choices
http://news.bbc.co.uk/go/rss/-/sport1/hi/cricket/9028456.stm
England Chairman of selectors Geoff Miller says Ashes squad members Monty
Panesar and Chris Tremlett derverve their place after improving their form
in county cricket.


3.Broad confident of England victory
http://news.bbc.co.uk/go/rss/-/sport1/hi/cricket/9027720.stm
England bowler Stuart Broad is confident England have all the "attributes"
to beat Australia in the upcoming Ashes Test series.
_______________________________________________
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers

Reply via email to