Split a domain

This is a simple script to split the domain name from a URL. It does that by usingPythons urlparse module.
import urlparse
url = "http://python.org"
domain = urlparse.urlsplit(url)[1].split(':')[0]
print "The domain name of the url is: ", domain

Leave a Reply

Your email address will not be published. Required fields are marked *