[Python-checkins] cpython (3.5): docs: Improve docs for os.path.commonprefix

yury.selivanov python-checkins at python.org
Tue Aug 18 06:00:43 CEST 2015


https://hg.python.org/cpython/rev/637a9d6328f6
changeset: 97426:637a9d6328f6
branch: 3.5
parent: 97424:17ce3486fd8f
user: Yury Selivanov <yselivanov at sprymix.com>
date: Mon Aug 17 23:43:43 2015 -0400
summary:
 docs: Improve docs for os.path.commonprefix
files:
 Doc/library/os.path.rst | 17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/Doc/library/os.path.rst b/Doc/library/os.path.rst
--- a/Doc/library/os.path.rst
+++ b/Doc/library/os.path.rst
@@ -82,8 +82,21 @@
 
 Return the longest path prefix (taken character-by-character) that is a
 prefix of all paths in *list*. If *list* is empty, return the empty string
- (``''``). Note that this may return invalid paths because it works a
- character at a time. To obtain a valid path, see :func:`commonpath`.
+ (``''``).
+
+ .. note::
+
+ This function may return invalid paths because it works a
+ character at a time. To obtain a valid path, see
+ :func:`commonpath`.
+
+ ::
+
+ >>> os.path.commonprefix(['/dir1/dir2', '/dir3/dir4'])
+ '/dir'
+
+ >>> os.path.commonpath(['/dir1/dir2', '/dir3/dir4'])
+ '/'
 
 
 .. function:: dirname(path)
-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list

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