Guest User

Untitled

a guest
Jul 16th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. >>> from urllib.parse import urlparse
  2. >>> url = "http://www.test.com:8080/cat1/cat2"
  3. >>> parsed = urlparse(url)
  4. >>> parsed
  5. ParseResult(scheme='http', netloc='www.test.com:8080', path='/cat1/cat2', params='', query='', fragment='')
  6. >>> parsed.path
  7. '/cat1/cat2'
  8. >>> parsed.path.split("/")
  9. ['', 'cat1', 'cat2']
Add Comment
Please, Sign In to add comment