urllib.parse.urlsplit()
urllib.parse.urlsplit() is a Python function in the Urllib Module category. Like urlparse() but split the fragment from the URL path (slightly faster). The syntax is urllib.parse.urlsplit(urlstring, scheme="", allow_fragments=True). Returns: SplitResult named tuple. A typical example: parts = urlsplit("https://example.com/path#frag")
parts.fragment # "frag". A close sibling is urllib.request.urlopen(), which opens a URL for reading (like GET request). Returns a file-like response object. A close sibling is urllib.request.Request(), which creates an HTTP request with custom headers and method. A close sibling is urllib.parse.urlparse(), which parses a URL into its components (scheme, netloc, path, params, query, fragment). A close sibling is urllib.parse.urlencode(), which encodes dictionary or sequence of pairs into a URL query string. More about this category: URL handling — request, parse, urlopen, urlparse, urlencode, quote. Related Urllib Module entries: urllib.request.urlopen(), urllib.request.Request(), urllib.parse.urlparse(), urllib.parse.urlencode(), urllib.parse.urljoin(), urllib.parse.quote(). This page is part of the free Python Reference documentation covering 978+ functions, methods, and modules with examples and parameter details.