From 80ac11f95f1c6b3f11f25de074a2d6eb1e261dc2 Mon Sep 17 00:00:00 2001 From: Yury Selivanov Date: Mon, 17 Aug 2015 23:43:43 -0400 Subject: docs: Improve docs for os.path.commonprefix --- Doc/library/os.path.rst | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/Doc/library/os.path.rst b/Doc/library/os.path.rst index e4fe44e..041277c 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) -- cgit v0.12