Add a as_uri() method as suggested by Charles-François, to return a file URI.
This commit is contained in:
parent
233fe61bf7
commit
f463d32478
|
@ -341,6 +341,15 @@ call ``bytes()`` on it, or use the ``as_bytes()`` method::
|
||||||
>>> bytes(p)
|
>>> bytes(p)
|
||||||
b'/home/antoine/pathlib/setup.py'
|
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
|
Properties
|
||||||
----------
|
----------
|
||||||
|
|
Loading…
Reference in New Issue