[Python-checkins] peps: Add a as_uri() method as suggested by Charles-François, to return a file URI.

antoine.pitrou python-checkins at python.org
Fri Mar 1 23:14:33 CET 2013


http://hg.python.org/peps/rev/96389266e4af
changeset: 4778:96389266e4af
user: Antoine Pitrou <solipsis at pitrou.net>
date: Fri Mar 01 23:10:53 2013 +0100
summary:
 Add a as_uri() method as suggested by Charles-François, to return a file URI.
files:
 pep-0428.txt | 9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/pep-0428.txt b/pep-0428.txt
--- a/pep-0428.txt
+++ b/pep-0428.txt
@@ -341,6 +341,15 @@
 >>> 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
 ----------
-- 
Repository URL: http://hg.python.org/peps


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /