how to pass value from output to a string in python
Question: I've been trying to make an application in python and I'm new to python. Well,
what I actually want to do is that . I want the feedparser to read the values
from an RSS of a website... say reddit... and then I want to make that output
as a stringand pass the value further to my code... my code right now..

    
    
    import feedparser
    import webbrowser
    
    feed = feedparser.parse('http://www.reddit.com/.rss')
    print feed['entries'][1]['title'] 
    print feed['entries'][1]['link'] 
    

It is working right now.. it parses the feed and I get the output I want...
Now, I want to use the "link" from the "print feed['entries'][1]['link'] " and
use it in the code further... how can I do so..? To be more specific.. I want
to open that URL in my browser... I concluded to something like this..

    
    
    import feedparser
    import webbrowser
    
    feed = feedparser.parse('http://www.reddit.com/.rss')
    print feed['entries'][1]['title'] 
    print feed['entries'][1]['link'] 
    
    mystring = 'feed['entries'][1]['link']'
    webbrowser.open('mystring')
    

It is of course not working... Please Help... if you need to know anything
else.. please let me know...


Answer: This is Reddit specific so it won't work on other RSS feeds but I thought this
might help you.

    
    
    from __future__ import print_function
    import praw
    
    
    r = praw.Reddit("my_cool_user_agent")
    submissions = r.get_front_page()
    for x in submissions:
        print("Title: {0} URL: {1} Permalink: {2}".format(x, x.url, x.permalink))
        print ("------------------------------------------------------------")
    

For Reddit there are 2 URLs that you might be interested in: the actual link
that is submitted (the 'external' link... think imgur, etc) and the permalink
to the Reddit post itself.

