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','.','partition'] > > 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