https://github.com/python/cpython/commit/6ec9c753c745bc23b2d2ed79aae31795438c0dab commit: 6ec9c753c745bc23b2d2ed79aae31795438c0dab branch: 3.13 author: Miss Islington (bot) <31488909+miss-isling...@users.noreply.github.com> committer: AA-Turner <9087854+aa-tur...@users.noreply.github.com> date: 2025-04-01T07:25:40Z summary:
[3.13] Minor improvements to the programming FAQ (GH-127261) (#131964) Minor improvements to the programming FAQ (GH-127261) (cherry picked from commit 23a658b9af410b72beeb28ba4ace2d83896c5631) Co-authored-by: Rafael Fontenelle <rffontene...@users.noreply.github.com> Co-authored-by: Adam Turner <9087854+aa-tur...@users.noreply.github.com> files: M Doc/faq/programming.rst diff --git a/Doc/faq/programming.rst b/Doc/faq/programming.rst index 776bab1ed5b779..b39efced304e45 100644 --- a/Doc/faq/programming.rst +++ b/Doc/faq/programming.rst @@ -986,8 +986,8 @@ There are various techniques. f() -Is there an equivalent to Perl's chomp() for removing trailing newlines from strings? -------------------------------------------------------------------------------------- +Is there an equivalent to Perl's ``chomp()`` for removing trailing newlines from strings? +----------------------------------------------------------------------------------------- You can use ``S.rstrip("\r\n")`` to remove all occurrences of any line terminator from the end of the string ``S`` without removing other trailing @@ -1005,8 +1005,8 @@ Since this is typically only desired when reading text one line at a time, using ``S.rstrip()`` this way works well. -Is there a scanf() or sscanf() equivalent? ------------------------------------------- +Is there a ``scanf()`` or ``sscanf()`` equivalent? +-------------------------------------------------- Not as such. @@ -1020,8 +1020,8 @@ For more complicated input parsing, regular expressions are more powerful than C's ``sscanf`` and better suited for the task. -What does 'UnicodeDecodeError' or 'UnicodeEncodeError' error mean? -------------------------------------------------------------------- +What does ``UnicodeDecodeError`` or ``UnicodeEncodeError`` error mean? +---------------------------------------------------------------------- See the :ref:`unicode-howto`. @@ -1036,7 +1036,7 @@ A raw string ending with an odd number of backslashes will escape the string's q >>> r'C:\this\will\not\work\' File "<stdin>", line 1 r'C:\this\will\not\work\' - ^ + ^ SyntaxError: unterminated string literal (detected at line 1) There are several workarounds for this. One is to use regular strings and double _______________________________________________ Python-checkins mailing list -- python-checkins@python.org To unsubscribe send an email to python-checkins-le...@python.org https://mail.python.org/mailman3/lists/python-checkins.python.org/ Member address: arch...@mail-archive.com