[Python-checkins] bpo-34931: [doc] clarify behavior of os.path.splitext() on paths with multiple leading periods (GH-30347) (GH-30369)
iritkatriel
webhook-mailer at python.org
Mon Jan 3 15:39:13 EST 2022
https://github.com/python/cpython/commit/4a792ca95c1a994b07d18fe06e2104d5b1e0b796
commit: 4a792ca95c1a994b07d18fe06e2104d5b1e0b796
branch: 3.9
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: iritkatriel <1055913+iritkatriel at users.noreply.github.com>
date: 2022-01-03T20:39:02Z
summary:
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 at users.noreply.github.com>
Co-authored-by: Irit Katriel <1055913+iritkatriel at users.noreply.github.com>
files:
M Doc/library/os.path.rst
diff --git a/Doc/library/os.path.rst b/Doc/library/os.path.rst
index 729649200209b..2fb6ea9da8e09 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`.
More information about the Python-checkins
mailing list