View Single Post
Old 08-04-2009, 09:26 AM   #635
kiklop74
Guru
kiklop74 can program the VCR without an owner's manual.kiklop74 can program the VCR without an owner's manual.kiklop74 can program the VCR without an owner's manual.kiklop74 can program the VCR without an owner's manual.kiklop74 can program the VCR without an owner's manual.kiklop74 can program the VCR without an owner's manual.kiklop74 can program the VCR without an owner's manual.kiklop74 can program the VCR without an owner's manual.kiklop74 can program the VCR without an owner's manual.kiklop74 can program the VCR without an owner's manual.kiklop74 can program the VCR without an owner's manual.
 
kiklop74's Avatar
 
Posts: 800
Karma: 194644
Join Date: Dec 2007
Location: Argentina
Device: Kindle Voyage
Quote:
Originally Posted by Malakai View Post
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
kiklop74 is offline