0

hi..
can anybody help me to have more efficient code..
i tried to do some simple regex to split an URL
i tried to do this on my own many times but i couldnt seem to get it right
i havent master regex yet..(im learning - but the learning curve is not as fast as i expected to)

site=re.split('/+','http://mercury.tiser.com.au/IMPCNT/ccid=26434/acc_random=57289995/SITE=NEWS/AREA=NEWS.HOME/NETWORKPROMO=SPOTLIGHT/AAMSZ=210X160/pageid=62961499')
print site

it will breaks up the url in to small chunks of list items everytime it encounter '/'

and i also tried

y=re.split(':/{1,2}','http://www.mercury.tiser.com.au/blabla')
print y

and it will give me


but what i really want is to make it look like

when the input is

http://mercury.tiser.com.au/IMPCNT/ccid=26434/acc_random=57289995/SITE=NEWS/AREA=NEWS.HOME/NETWORKPROMO=SPOTLIGHT/AAMSZ=210X160/pageid=62961499

so i want to omit all the URL after .au/ and save it in the list

anybody knows how to make it look the way i need it?

thanks...

2
Contributors
2
Replies
3
Views
10 Years
Discussion Span
Last Post by bergy_nj
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.