Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(13033)

Side by Side Diff: Doc/library/os.path.rst

Issue 4755: Common path prefix
Patch Set: Created 10 years, 10 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | Lib/genericpath.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 :mod:`os.path` --- Common pathname manipulations 2 :mod:`os.path` --- Common pathname manipulations
3 ================================================ 3 ================================================
4 4
5 .. module:: os.path 5 .. module:: os.path
6 :synopsis: Operations on pathnames. 6 :synopsis: Operations on pathnames.
7 7
8 8
9 .. index:: single: path; operations 9 .. index:: single: path; operations
10 10
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 from the Unix :program:`basename` program; where :program:`basename` for 44 from the Unix :program:`basename` program; where :program:`basename` for
45 ``'/foo/bar/'`` returns ``'bar'``, the :func:`basename` function returns an 45 ``'/foo/bar/'`` returns ``'bar'``, the :func:`basename` function returns an
46 empty string (``''``). 46 empty string (``''``).
47 47
48 48
49 .. function:: commonprefix(list) 49 .. function:: commonprefix(list)
50 50
51 Return the longest path prefix (taken character-by-character) that is a prefi x 51 Return the longest path prefix (taken character-by-character) that is a prefi x
52 of all paths in *list*. If *list* is empty, return the empty string (``''`` ). 52 of all paths in *list*. If *list* is empty, return the empty string (``''`` ).
53 Note that this may return invalid paths because it works a character at a tim e. 53 Note that this may return invalid paths because it works a character at a tim e.
54
55
56 .. function:: commonpathprefix(list, separator=None)
techtonik 2012/05/23 10:25:38 .. function:: commonpath(list, separator=os.sep)
57
58 Return the longest path prefix (taken component-by-component) that is a
59 prefix of all paths in *list*. If *list* is empty, return the empty
60 string (``''``). Unlike :func:`commonprefix`, this will only return the
61 empty string or complete paths. The optional second argument defaults to
62 os.sep on platforms other than Windows and OS/2. On those platforms it
63 defaults to either os.sep or os.altsep.
techtonik 2012/05/23 10:25:38 Return the longest common path for all paths in *l
54 64
55 65
56 .. function:: dirname(path) 66 .. function:: dirname(path)
57 67
58 Return the directory name of pathname *path*. This is the first half of the 68 Return the directory name of pathname *path*. This is the first half of the
59 pair returned by ``split(path)``. 69 pair returned by ``split(path)``.
60 70
61 71
62 .. function:: exists(path) 72 .. function:: exists(path)
63 73
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 mount point (such as ``r'\\host\mount'``), if present, and *rest* the rest of 282 mount point (such as ``r'\\host\mount'``), if present, and *rest* the rest of
273 the path (such as ``r'\path\file.ext'``). For paths containing drive letter s, 283 the path (such as ``r'\path\file.ext'``). For paths containing drive letter s,
274 *unc* will always be the empty string. Availability: Windows. 284 *unc* will always be the empty string. Availability: Windows.
275 285
276 286
277 .. data:: supports_unicode_filenames 287 .. data:: supports_unicode_filenames
278 288
279 True if arbitrary Unicode strings can be used as file names (within limitatio ns 289 True if arbitrary Unicode strings can be used as file names (within limitatio ns
280 imposed by the file system), and if :func:`os.listdir` returns strings that 290 imposed by the file system), and if :func:`os.listdir` returns strings that
281 contain characters that cannot be represented by ASCII. 291 contain characters that cannot be represented by ASCII.
OLDNEW
« no previous file with comments | « no previous file | Lib/genericpath.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+