Quote:
Originally Posted by Malakai
Hey guys im tryin to grab a print version using the advanced version but i need to set the url.replace to change two things in the url.
here an example of the original url
http://www.dpreview.com/reviews/olympusep1/?from=rss
this is the url for the print version
http://www.dpreview.com/reviews/prin...iew=OlympusEP1
how do i get it to remove the /?from=rss at the end
This is what i currently have
def print_version(self, url):
return url.replace('http://www.dpreview.com/reviews/', 'http://www.dpreview.com/reviews/print.asp?review=')
|
Try this:
Code:
def print_version(self, url):
baseurl = url.rpartition('/?')[0]
turl = baseurl.partition('/reviews/')[2]
return 'http://www.dpreview.com/reviews/print.asp?review=' + turl