We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d61714d commit 80ac11fCopy full SHA for 80ac11f
1 file changed
Doc/library/os.path.rst
@@ -82,8 +82,21 @@ the :mod:`glob` module.)
82
83
Return the longest path prefix (taken character-by-character) that is a
84
prefix of all paths in *list*. If *list* is empty, return the empty string
85
- (``''``). Note that this may return invalid paths because it works a
86
- character at a time. To obtain a valid path, see :func:`commonpath`.
+ (``''``).
+
87
+ .. note::
88
89
+ This function may return invalid paths because it works a
90
+ character at a time. To obtain a valid path, see
91
+ :func:`commonpath`.
92
93
+ ::
94
95
+ >>> os.path.commonprefix(['/dir1/dir2', '/dir3/dir4'])
96
+ '/dir'
97
98
+ >>> os.path.commonpath(['/dir1/dir2', '/dir3/dir4'])
99
+ '/'
100
101
102
.. function:: dirname(path)
0 commit comments