nturl2path.pathname2url
Up: nturl2path | Next: nturl2path.url2pathname
Rel: nturl2path.url2pathname
Ref: docs.python.org — nturl2path.pathname2url
Tags: #public #python3 #stdlib #nturl2path
Import
import nturl2path
from nturl2path import pathname2url
Signature & Overview
nturl2path.pathname2url(p)
OS-specific conversion from a file system path to a relative URL of the 'file' scheme; not recommended for general use.
Usage
import nturl2path
assert nturl2path.pathname2url(r"C:\Users\Ada\a.txt") == "///C:/Users/Ada/a.txt"
Gotchas
- Internal helper: Prefer
urllib.request.pathname2url()orPath.as_uri()in portable code.
REPL Inspect
from nturl2path import pathname2url
help(pathname2url)
Linked from
Related notes
- tuts/python3/stdlib_module/nturl2path Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/nturl2path/url2pathname Linked here; links to this page; shared tags: #stdlib
- tuts/c/stdlib shared tags: #stdlib
- tuts/c/stdlib/assert shared tags: #stdlib
- tuts/c/stdlib/assert/assert shared tags: #stdlib
- tuts/c/stdlib/assert/static_assert shared tags: #stdlib
- tuts/c/stdlib/ctype shared tags: #stdlib
- tuts/c/stdlib/ctype/isalpha shared tags: #stdlib
- tuts/c/stdlib/ctype/isdigit shared tags: #stdlib
- tuts/c/stdlib/ctype/isspace shared tags: #stdlib