How do I get specific path sections from a url? For example, I want a function which operates on this:
http://www.mydomain.com/hithere?image=2934
import urlparse output = urlparse.urlparse('http://www.example.com/temp/something/happen/index.html').path output '/temp/something/happen/index.html' Split the path -- inbuilt rpartition func of string output.rpartition('/')[0] '/temp/something/happen'