Add a as_uri() method as suggested by Charles-François, to return a file URI.

This commit is contained in:
Antoine Pitrou 2013-03-01 23:10:53 +01:00
parent 233fe61bf7
commit f463d32478
1 changed files with 9 additions and 0 deletions

View File

@ -341,6 +341,15 @@ call ``bytes()`` on it, or use the ``as_bytes()`` method::
>>> bytes(p)
b'/home/antoine/pathlib/setup.py'
To represent the path as a ``file`` URI, call the ``as_uri()`` method::
>>> p = PurePosixPath('/etc/passwd')
>>> p.as_uri()
'file:///etc/passwd'
>>> p = PureNTPath('c:/Windows')
>>> p.as_uri()
'file:///c:/Windows'
Properties
----------