The nturl2path module
(Implementation). This module contains code to map uniform resource locators (URLs) to Windows filenames, and back.
Example: Using the
nturl2path module
# File: nturl2path-example-1.py import nturl2path file = r"c:\my\little\pony" print nturl2path.pathname2url(file) print nturl2path.url2pathname(nturl2path.pathname2url(file))
///C|/my/little/pony C:\my\little\pony
This module should not be used directly; for portability, access these functions via the urllib module instead:
Example: Using the
nturl2path module via the urllib module
# File: nturl2path-example-2.py import urllib file = r"c:\my\little\pony" print urllib.pathname2url(file) print urllib.url2pathname(urllib.pathname2url(file))
///C|/my/little/pony C:\my\little\pony