Extract domain name from url Python

前端 未结 4 396
忘掉有多难
忘掉有多难 2020-12-11 01:16

I am tring to extract the domain names out of a list of urls. just like in https://stackoverflow.com/questions/18331948/extract-domain-name-from-the-url
My problem is th

4条回答
  •  眼角桃花
    2020-12-11 01:57

    It seems you can use urlparse https://docs.python.org/3/library/urllib.parse.html for that url, and then extract the netloc.

    And from the netloc you could easily extract the domain name by using split

提交回复
热议问题