In <[email protected]> macm 
<[email protected]> writes:

>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 = ["//",";","/", "?", ":", "@", "=" , "&","#"]


You forgot '.'.

>>> import re # sorry
>>> sp = re.compile('(//?|[;?:@=&#.])')
>>> filter(len, sp.split(url))
['http', ':', '//', 'docs', '.', 'python', '.', 'org', '/', 'dev', '/', 
'library', '/', 'stdtypes', '.', 'html', '\
?', 'highlight', '=', 'partition', '#', 'str', '.', 'partition']

~kj
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to