@@ -552,7 +552,7 @@ Standard C. The recognized escape sequences are:
552552+-----------------+---------------------------------+-------+
553553| Escape Sequence | Meaning | Notes |
554554+=================+=================================+=======+
555- | ``\newline `` | Backslash and newline ignored | |
555+ | ``\ `` \ <newline> | Backslash and newline ignored | \( 1) |
556556+-----------------+---------------------------------+-------+
557557| ``\\ `` | Backslash (``\ ``) | |
558558+-----------------+---------------------------------+-------+
@@ -574,53 +574,64 @@ Standard C. The recognized escape sequences are:
574574+-----------------+---------------------------------+-------+
575575| ``\v `` | ASCII Vertical Tab (VT) | |
576576+-----------------+---------------------------------+-------+
577- | ``\ooo `` | Character with octal value | (1,3 ) |
577+ | ``\ooo `` | Character with octal value | (2,4 ) |
578578| | *ooo * | |
579579+-----------------+---------------------------------+-------+
580- | ``\xhh `` | Character with hex value *hh * | (2,3 ) |
580+ | ``\xhh `` | Character with hex value *hh * | (3,4 ) |
581581+-----------------+---------------------------------+-------+
582582
583583Escape sequences only recognized in string literals are:
584584
585585+-----------------+---------------------------------+-------+
586586| Escape Sequence | Meaning | Notes |
587587+=================+=================================+=======+
588- | ``\N{name} `` | Character named *name * in the | \( 4 ) |
588+ | ``\N{name} `` | Character named *name * in the | \( 5 ) |
589589| | Unicode database | |
590590+-----------------+---------------------------------+-------+
591- | ``\uxxxx `` | Character with 16-bit hex value | \( 5 ) |
591+ | ``\uxxxx `` | Character with 16-bit hex value | \( 6 ) |
592592| | *xxxx * | |
593593+-----------------+---------------------------------+-------+
594- | ``\Uxxxxxxxx `` | Character with 32-bit hex value | \( 6 ) |
594+ | ``\Uxxxxxxxx `` | Character with 32-bit hex value | \( 7 ) |
595595| | *xxxxxxxx * | |
596596+-----------------+---------------------------------+-------+
597597
598598Notes:
599599
600600(1)
601+ A backslash can be added at the end of a line to ignore the newline::
602+
603+ >>> 'This string will not include \
604+ ... backslashes or newline characters.'
605+ 'This string will not include backslashes or newline characters.'
606+
607+ The same result can be achieved using :ref: `triple-quoted strings <strings >`,
608+ or parentheses and :ref: `string literal concatenation <string-concatenation >`.
609+
610+
611+ (2)
601612 As in Standard C, up to three octal digits are accepted.
602613
603614 .. versionchanged :: 3.11
604615 Octal escapes with value larger than ``0o377 `` produce a :exc: `DeprecationWarning `.
605616 In a future Python version they will be a :exc: `SyntaxWarning ` and
606617 eventually a :exc: `SyntaxError `.
607618
608- (2 )
619+ (3 )
609620 Unlike in Standard C, exactly two hex digits are required.
610621
611- (3 )
622+ (4 )
612623 In a bytes literal, hexadecimal and octal escapes denote the byte with the
613624 given value. In a string literal, these escapes denote a Unicode character
614625 with the given value.
615626
616- (4 )
627+ (5 )
617628 .. versionchanged :: 3.3
618629 Support for name aliases [# ]_ has been added.
619630
620- (5 )
631+ (6 )
621632 Exactly four hex digits are required.
622633
623- (6 )
634+ (7 )
624635 Any Unicode character can be encoded this way. Exactly eight hex digits
625636 are required.
626637
0 commit comments