urllib.parse.urldefrag(url)
If url contains a fragment identifier, return a modified version of url with no fragment identifier, and the fragment identifier as a separate string. If there is no fragment identifier in url, return url unmodified and an empty string.
The return value is actually an instance of a subclass of tuple
. This class has the following additional read-only convenience attributes:
Attribute | Index | Value | Value if not present |
---|---|---|---|
url | 0 | URL with no fragment | empty string |
fragment | 1 | Fragment identifier | empty string |
See section Structured Parse Results for more information on the result object.
Changed in version 3.2: Result is a structured object rather than a simple 2-tuple.
Please login to continue.