@@ -986,8 +986,8 @@ There are various techniques.
986
986
f()
987
987
988
988
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
+ -----------------------------------------------------------------------------------------
991
991
992
992
You can use ``S.rstrip("\r\n") `` to remove all occurrences of any line
993
993
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
1005
1005
``S.rstrip() `` this way works well.
1006
1006
1007
1007
1008
- Is there a scanf() or sscanf() equivalent?
1009
- ------------------------------------------
1008
+ Is there a `` scanf() `` or `` sscanf() `` equivalent?
1009
+ --------------------------------------------------
1010
1010
1011
1011
Not as such.
1012
1012
@@ -1020,8 +1020,8 @@ For more complicated input parsing, regular expressions are more powerful
1020
1020
than C's ``sscanf `` and better suited for the task.
1021
1021
1022
1022
1023
- What does ' UnicodeDecodeError' or ' UnicodeEncodeError' error mean?
1024
- -------------------------------------------------------------------
1023
+ What does `` UnicodeDecodeError `` or `` UnicodeEncodeError `` error mean?
1024
+ ----------------------------------------------------------------------
1025
1025
1026
1026
See the :ref: `unicode-howto `.
1027
1027
@@ -1036,7 +1036,7 @@ A raw string ending with an odd number of backslashes will escape the string's q
1036
1036
>>> r'C:\this\will\not\work\'
1037
1037
File "<stdin>", line 1
1038
1038
r'C:\this\will\not\work\'
1039
- ^
1039
+ ^
1040
1040
SyntaxError: unterminated string literal (detected at line 1)
1041
1041
1042
1042
There are several workarounds for this. One is to use regular strings and double
0 commit comments