https://github.com/python/cpython/commit/99cc3d1842e9f4d2a3b1fbda7135556a2af52bff commit: 99cc3d1842e9f4d2a3b1fbda7135556a2af52bff branch: 3.13 author: Miss Islington (bot) <[email protected]> committer: encukou <[email protected]> date: 2026-02-12T11:44:42+01:00 summary:
[3.13] gh-57095: Add note about input splitting in `datetime.*.strptime` (GH-131049) (GH-144734) (cherry picked from commit 2e3e76e5cde34786780f5b3723f495fdbdf37c84) Co-authored-by: Petr Viktorin <[email protected]> files: M Doc/library/datetime.rst diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst index 64356c9b6b0472..ea7904fe6d6d49 100644 --- a/Doc/library/datetime.rst +++ b/Doc/library/datetime.rst @@ -2591,6 +2591,12 @@ For the :meth:`.datetime.strptime` class method, 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` will raise when encountering February 29 because the default year of 1900 is _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: [email protected]
