Python: get domain name from url
December 24, 2009 22:25:38 Last update: April 04, 2011 13:48:24
Use the urlparse module to parse a URL into parts.
The
The
urlparse function parses a URL into six components, returning a 6-tuple. This corresponds to the general structure of a URL: scheme://netloc/path;parameters?query#fragment
>>> from urlparse import urlparse >>> parts = urlparse('http://www.google.com/search?hl=en&source=hp&q=python') >>> parts ('http', 'www.google.com', '/search', '', 'hl=en&source=hp&q=python', '') >>>
Easy email testing with http://www.ximailstop.com