Partition Recursive
Rhodri James
rhodri at wildebst.demon.co.uk
Thu Dec 23 18:34:46 EST 2010
Please don't top-post, it makes everything harder to read.
(Re-ordering to make sense...)
On Thu, 23 Dec 2010 18:05:39 -0000, macm <moura.mario at gmail.com> wrote:
> On Dec 23, 3:57 pm, Jon Clements <jon... at googlemail.com> wrote:
>> I would use urlparse.urlsplit, then split further, if required.
>>
>> >>> urlsplit(url)
>>
>> SplitResult(scheme='http', netloc='docs.python.org', path='/dev/
>> library/stdtypes.html', query='highlight=partition',
>> fragment='str.partition')
> urlparse isnt a option.
Why not?
> My reasult must be:
>
> myList =
> ['http',':','//','docs','.','python','.','org','/','dev','/','library','/',
> 'stdtypes','.','html','?','highlight','=','partition','#','str','.','partition']
Deriving this from the output of urlparse isn't that hard. I'm slightly
baffled as to why this is more useful, but that's your problem.
> re module is slow.
Is it slow enough to be an issue?
> Even I make a loop in urlparse.urlsplit I can lost specialMeaning
> order.
If you mean what I think you mean, and you're relying on getting queries
from browsers in a defined order, you are in for a world of pain.
> Seen easy but best aproach will be recursive.
If speed is as important to you as you imply, I doubt it.
--
Rhodri James *-* Wildebeest Herder to the Masses
More information about the Python-list
mailing list