Yes, there is the urlparse
module in Python 2.7 and the urllib.parse
function in Python 3, but each of them just creates a 6-tuple of URL parts, and it's up to you to know that the query
part, for example, is at position 4.
So here's a neat little wrapper around that functionality which gives named fields to each part:
So, to get the query
part, you just do parsed_url.query
instead of parsed_url[4]
.
No comments:
Post a Comment