summaryrefslogtreecommitdiff
path: root/Doc/library/os.path.rst
diff options
context:
space:
mode:
authorYury Selivanov <yselivanov@sprymix.com>2015-08-17 23:43:43 -0400
committerYury Selivanov <yselivanov@sprymix.com>2015-08-17 23:43:43 -0400
commit80ac11f95f1c6b3f11f25de074a2d6eb1e261dc2 (patch)
treefe894f04fe129f50b2b8f006204bb50dd5b3ffa9 /Doc/library/os.path.rst
parentd61714d236138ac7dc0228ee90314dfa8c3cc04d (diff)
downloadcpython-git-80ac11f95f1c6b3f11f25de074a2d6eb1e261dc2.tar.gz
docs: Improve docs for os.path.commonprefix
Diffstat (limited to 'Doc/library/os.path.rst')
-rw-r--r--Doc/library/os.path.rst17
1 files changed, 15 insertions, 2 deletions
diff --git a/Doc/library/os.path.rst b/Doc/library/os.path.rst
index e4fe44ed94..041277cd9c 100644
--- a/Doc/library/os.path.rst
+++ b/Doc/library/os.path.rst
@@ -82,8 +82,21 @@ the :mod:`glob` module.)
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)