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).split(':') print "The domain name of the url is: ", domain
Recommended Python Training
Course: Python 3 For Beginners
Over 15 hours of video content with guided instruction for beginners. Learn how to create real world applications and master the basics.