Originally Posted by dwanthny
Is there the option of using wildcards when subbing out for the print version?
I think the usual way to handle this type of situation is to use the split function and split on the slash character. That will give you a list, with each element in the list being text in the original URL that was separated by a slash. Then insert the "v-print" text into the list, then reassemble using slashes.
def print_version(self, url):
parts = url.split('/')
print_url = 'http://' + parts + '/' + parts + '/' + parts + '/' + parts + '/' + parts \
+ '/v-print/' + parts + '/' + parts