Skip to content

Commit 6cdd3a4

Browse files
miss-islingtonrffontenelleAA-Turner
authored
[3.12] Minor improvements to the programming FAQ (GH-127261) (#131965)
Minor improvements to the programming FAQ (GH-127261) (cherry picked from commit 23a658b) Co-authored-by: Rafael Fontenelle <[email protected]> Co-authored-by: Adam Turner <[email protected]>
1 parent ce85eb5 commit 6cdd3a4

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

Diff for: Doc/faq/programming.rst

+7-7
Original file line numberDiff line numberDiff line change
@@ -986,8 +986,8 @@ There are various techniques.
986986
f()
987987

988988

989-
Is there an equivalent to Perl's chomp() for removing trailing newlines from strings?
990-
-------------------------------------------------------------------------------------
989+
Is there an equivalent to Perl's ``chomp()`` for removing trailing newlines from strings?
990+
-----------------------------------------------------------------------------------------
991991

992992
You can use ``S.rstrip("\r\n")`` to remove all occurrences of any line
993993
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
10051005
``S.rstrip()`` this way works well.
10061006

10071007

1008-
Is there a scanf() or sscanf() equivalent?
1009-
------------------------------------------
1008+
Is there a ``scanf()`` or ``sscanf()`` equivalent?
1009+
--------------------------------------------------
10101010

10111011
Not as such.
10121012

@@ -1020,8 +1020,8 @@ For more complicated input parsing, regular expressions are more powerful
10201020
than C's ``sscanf`` and better suited for the task.
10211021

10221022

1023-
What does 'UnicodeDecodeError' or 'UnicodeEncodeError' error mean?
1024-
-------------------------------------------------------------------
1023+
What does ``UnicodeDecodeError`` or ``UnicodeEncodeError`` error mean?
1024+
----------------------------------------------------------------------
10251025

10261026
See the :ref:`unicode-howto`.
10271027

@@ -1036,7 +1036,7 @@ A raw string ending with an odd number of backslashes will escape the string's q
10361036
>>> r'C:\this\will\not\work\'
10371037
File "<stdin>", line 1
10381038
r'C:\this\will\not\work\'
1039-
^
1039+
^
10401040
SyntaxError: unterminated string literal (detected at line 1)
10411041

10421042
There are several workarounds for this. One is to use regular strings and double

0 commit comments

Comments
 (0)