@@ -470,12 +470,16 @@ the :mod:`glob` module.)
470470 On Windows, splits a pathname into drive/UNC sharepoint and relative path.
471471
472472 If the path contains a drive letter, drive will contain everything
473- up to and including the colon.
474- e.g. ``splitdrive("c:/dir") `` returns ``("c:", "/dir") ``
473+ up to and including the colon::
474+
475+ >>> splitdrive("c:/dir")
476+ ("c:", "/dir")
475477
476478 If the path contains a UNC path, drive will contain the host name
477- and share, up to but not including the fourth separator.
478- e.g. ``splitdrive("//host/computer/dir") `` returns ``("//host/computer", "/dir") ``
479+ and share, up to but not including the fourth separator::
480+
481+ >>> splitdrive("//host/computer/dir")
482+ ("//host/computer", "/dir")
479483
480484 .. versionchanged :: 3.6
481485 Accepts a :term: `path-like object `.
@@ -484,9 +488,24 @@ the :mod:`glob` module.)
484488.. function :: splitext(path)
485489
486490 Split the pathname *path * into a pair ``(root, ext) `` such that ``root + ext ==
487- path ``, and *ext * is empty or begins with a period and contains at most one
488- period. Leading periods on the basename are ignored; ``splitext('.cshrc') ``
489- returns ``('.cshrc', '') ``.
491+ path ``, and the extension, *ext *, is empty or begins with a period and contains at
492+ most one period.
493+
494+ If the path contains no extension, *ext * will be ``'' ``::
495+
496+ >>> splitext('bar')
497+ ('bar', '')
498+
499+ If the path contains an extension, then *ext * will be set to this extension,
500+ including the leading period. Note that previous periods will be ignored::
501+
502+ >>> splitext('foo.bar.exe')
503+ ('foo.bar', '.exe')
504+
505+ Leading periods on the basename are ignored::
506+
507+ >>> splitext('.cshrc')
508+ ('.cshrc', '')
490509
491510 .. versionchanged :: 3.6
492511 Accepts a :term: `path-like object `.
0 commit comments