I am new to Python and it seems to have a lot of nice functions that I don't know about. What function can I use to get the root site name? For example, how would I get faqs.org if I gave the function the URL "http://www.faqs.org/docs/diveintopython/kgp_commandline.html"?
>>> from urllib.parse import urlparse >>> urlparse('http://www.cwi.nl:80/%7Eguido/Python.html').hostname 'www.cwi.nl'
2.1m questions
2.1m answers
60 comments
57.0k users