The nturl2path module

(Implementation) The nturl2path module, shown in Example 13-15, contains code to map between URLs and Windows filenames.

Example 13-15. Using the nturl2path Module

import nturl2path

file = r"c:mylittlepony"

print nturl2path.pathname2url(file)
print nturl2path.url2pathname(nturl2path.pathname2url(file))


This module should not be used directly; for portability, access these functions via the urllib module instead, as shown in Example 13-16.

Example 13-16. Using the nturl2path Module via the urllib Module

import urllib

file = r"c:mylittlepony"

print urllib.pathname2url(file)
print urllib.url2pathname(urllib.pathname2url(file))


Core Modules

More Standard Modules

Threads and Processes

Data Representation

File Formats

Mail and News Message Processing

Network Protocols


Multimedia Modules

Data Storage

Tools and Utilities

Platform-Specific Modules

Implementation Support Modules

Other Modules

Python Standard Library
Python Standard Library (Nutshell Handbooks) with
ISBN: 0596000960
EAN: 2147483647
Year: 2000
Pages: 252
Authors: Fredrik Lundh © 2008-2020.
If you may any questions please contact us: