1

Imagine that I have url

http://www.google.com/subdomain/blah-blah.../.. /..

So I want to extract 4 things from this 1) The Protocol: "http" 2) "www" 3) domain name : google" 4) "com" portion 5) subdomain par: all those after .com part But as you can see this link can be anything

ftp://google.net/hola-hola

now this might also be a valid link. So how do I extract these various portions of url using python

1 Answer 1

8

See urlparse.

http://docs.python.org/library/urlparse.html

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.