How to get the site name from a URL in Python

1 Answer

0 votes
from urllib.parse import urlparse

result = urlparse('https://www.collectivesolver.com:80/Python.html').hostname

print(result) 



'''
run:

www.collectivesolver.com

'''

 



answered Jul 9, 2025 by avibootz

Related questions

2 answers 560 views
1 answer 280 views
1 answer 276 views
1 answer 288 views
1 answer 346 views
...