Language Syntax

String escape sequence — Python syntax

Backslash escapes represent characters such as newline, tab, backslash and Unicode code points. Hex byte escapes use exactly two hex digits; Unicode escapes use four or eight digits. In 3.13 unrecognized escapes can produce SyntaxWarning; raw strings preserve most backslashes.

Formal Syntax & Structure

python syntaxpython
"\n\t\\\u0041"

Working Example

Example Snippetpython
text='\u0041\n\x42'print(list(map(ord,text)))
Python Reference