From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Mon, 3 Jan 2022 20:39:02 +0000 (-0800) Subject: bpo-34931: [doc] clarify behavior of os.path.splitext() on paths with multiple leadin... X-Git-Tag: v3.9.10~26 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4a792ca95c1a994b07d18fe06e2104d5b1e0b796;p=thirdparty%2FPython%2Fcpython.git bpo-34931: [doc] clarify behavior of os.path.splitext() on paths with multiple leading periods (GH-30347) (GH-30369) (cherry picked from commit 51700bf08b0dd4baf998440b2ebfaa488a2855ba) Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com> Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com> --- diff --git a/Doc/library/os.path.rst b/Doc/library/os.path.rst index 729649200209..2fb6ea9da8e0 100644 --- a/Doc/library/os.path.rst +++ b/Doc/library/os.path.rst @@ -489,11 +489,16 @@ the :mod:`glob` module.) >>> splitext('foo.bar.exe') ('foo.bar', '.exe') + >>> splitext('/foo/bar.exe') + ('/foo/bar', '.exe') - Leading periods on the basename are ignored:: + Leading periods of the last component of the path are considered to + be part of the root:: >>> splitext('.cshrc') ('.cshrc', '') + >>> splitext('/foo/....jpg') + ('/foo/....jpg', '') .. versionchanged:: 3.6 Accepts a :term:`path-like object`.