15 Jan
2003
15 Jan
'03
11:47 p.m.
Use the urlparse module: http://www.python.org/doc/current/lib/module-urlparse.html urlparse (urlstring[, default_scheme[, allow_fragments]]) -- function of module urlparse Parse a URL into 6 components, returning a 6-tuple: (addressing scheme, network location, path, parameters, query, fragment identifier). This corresponds to the general structure of a URL: scheme://netloc/path;parameters?query#fragment. eg:
from urlparse import urlparse urlparse('http://http://localhost:8080/mysite/index_html#18')[-1] 18 -- Andy McKay