Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- >>> from urllib.parse import urlparse
- >>> url = "http://www.test.com:8080/cat1/cat2"
- >>> parsed = urlparse(url)
- >>> parsed
- ParseResult(scheme='http', netloc='www.test.com:8080', path='/cat1/cat2', params='', query='', fragment='')
- >>> parsed.path
- '/cat1/cat2'
- >>> parsed.path.split("/")
- ['', 'cat1', 'cat2']
Add Comment
Please, Sign In to add comment