Hi urlparse isnt a option.
My reasult must be: myList = ['http',':','//','docs','.','python','.','org','/','dev','/','library','/', 'stdtypes','.','html','?','highlight','=','partition','#','str','.','partition'] re module is slow. Even I make a loop in urlparse.urlsplit I can lost specialMeaning order. Seen easy but best aproach will be recursive. Regards Mario On Dec 23, 3:57 pm, Jon Clements <jon...@googlemail.com> wrote: > On Dec 23, 5:26 pm, macm <moura.ma...@gmail.com> wrote: > > > > > > > > > > > Hi Folks > > > I have this: > > > url = 'http://docs.python.org/dev/library/stdtypes.html? > > highlight=partition#str.partition' > > > So I want convert to > > > myList = > > ['http',':','//','docs','.','python','.','org','/','dev','/','library','/', > > 'stdtypes','.','html','?','highlight','=','partition','#','str','.','partit > > ion'] > > > The reserved char are: > > > specialMeaning = ["//",";","/", "?", ":", "@", "=" , "&","#"] > > > Regards > > > Mario > > 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') > > Jon. -- http://mail.python.org/mailman/listinfo/python-list