I've been trying to extract the domain names from a list of urls, so that http://supremecosts.com/contact-us/ would become http://supremecosts.com.  I'm trying to find a clean way of doing it that will be adaptable to various gtlds and cctlds.
Probably a silly, yet valid way of doing this is:
Save the URL in a string and scan it from back to front. As soon as you come across a full stop, scrap everything from 3 spaces ahead. I believe urls do not have full stops after the domain names. Please correct me if I am wrong.
Extract domain name only from url, getting rid of the path (Python)