(Implementation) The nturl2path module, shown in Example 13-15, contains code to map between URLs and Windows filenames.
File: nturl2path-example-1.py import nturl2path file = r"c:mylittlepony" print nturl2path.pathname2url(file) print nturl2path.url2pathname(nturl2path.pathname2url(file)) ///C|/my/little/pony C:mylittlepony
This module should not be used directly; for portability, access these functions via the urllib module instead, as shown in Example 13-16.
File: nturl2path-example-2.py import urllib file = r"c:mylittlepony" print urllib.pathname2url(file) print urllib.url2pathname(urllib.pathname2url(file)) ///C|/my/little/pony C:mylittlepony
Core Modules
More Standard Modules
Threads and Processes
Data Representation
File Formats
Mail and News Message Processing
Network Protocols
Internationalization
Multimedia Modules
Data Storage
Tools and Utilities
Platform-Specific Modules
Implementation Support Modules
Other Modules