]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.14] gh-57095: Add note about input splitting in `datetime.*.strptime` (GH-131049...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 12 Feb 2026 10:44:32 +0000 (11:44 +0100)
committerGitHub <noreply@github.com>
Thu, 12 Feb 2026 10:44:32 +0000 (11:44 +0100)
(cherry picked from commit 2e3e76e5cde34786780f5b3723f495fdbdf37c84)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Doc/library/datetime.rst

index c17ff8986ab8da5fdd49b51f32cb8065a662b5e6..9780adf5f4e131a681e5f46b891e73f65f609a48 100644 (file)
@@ -2638,6 +2638,12 @@ For the :meth:`.datetime.strptime` and :meth:`.date.strptime` class methods,
 the default value is ``1900-01-01T00:00:00.000``: any components not specified
 in the format string will be pulled from the default value.
 
+.. note::
+   Format strings without separators can be ambiguous for parsing. For
+   example, with ``%Y%m%d``, the string ``2026111`` may be parsed either as
+   ``2026-11-01`` or as ``2026-01-11``.
+   Use separators to ensure the input is parsed as intended.
+
 .. note::
    When used to parse partial dates lacking a year, :meth:`.datetime.strptime`
    and :meth:`.date.strptime` will raise when encountering February 29 because