From f463d3247801b7aab52236426cf1fb1b8ed6c27c Mon Sep 17 00:00:00 2001 From: Antoine Pitrou Date: Fri, 1 Mar 2013 23:10:53 +0100 Subject: [PATCH] =?UTF-8?q?Add=20a=20as=5Furi()=20method=20as=20suggested?= =?UTF-8?q?=20by=20Charles-Fran=C3=A7ois,=20to=20return=20a=20file=20URI.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pep-0428.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pep-0428.txt b/pep-0428.txt index 61d82d81c..e0ebf8cbd 100644 --- a/pep-0428.txt +++ b/pep-0428.txt @@ -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 ----------