Last active
October 4, 2022 00:16
-
-
Save TunedMystic/eeb95a23a2601890fe4f17b33f53ed7a to your computer and use it in GitHub Desktop.
Parse the domain name from a url.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from urllib.parse import urlparse | |
def parse_domain_name(url: str) -> str: | |
""" | |
Parse the domain name from the given url. | |
""" | |
return urlparse(url).hostname.split('.')[-2] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment