I've been building a custom news feed for the UK guardian, but I have hit a problem because my knowledge of python is none existent
Here's the rub:
The rss feed returns an article url in the format of:
The print version of the url looks like this:
So I need to replace that last bit of the url, starting the question mark (which changes from feed to feed, ie politics changes to culture) and replace it with /print.
From looking at the included feeds I think I need to be using urlparse, but can't figure out how to structure it.
My starting point is this from the WSJ recipie, but obviously it won't work in its current form:
def print_version(self, url):
article = urlparse.urlparse(url).path.rpartition('/')[-1]
Any help is MUCH appreciated.