From 9c5951dcf441ae01953734074a71dff4a780ad93 Mon Sep 17 00:00:00 2001 From: David Rotermund <54365609+davrot@users.noreply.github.com> Date: Tue, 5 Dec 2023 19:02:50 +0100 Subject: [PATCH] Update README.md Signed-off-by: David Rotermund <54365609+davrot@users.noreply.github.com> --- .../formatted_string_literals/README.md | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/python_basics/formatted_string_literals/README.md b/python_basics/formatted_string_literals/README.md index 4f7038c..b1bc450 100644 --- a/python_basics/formatted_string_literals/README.md +++ b/python_basics/formatted_string_literals/README.md @@ -198,6 +198,30 @@ print(f"{d:%Y-%m-%d %H:%M:%S}") see [here](https://docs.python.org/3/library/datetime.html#strftime-and-strptime-format-codes) for the date formats  +## [Escape Sequence​](https://docs.python.org/3/reference/lexical_analysis.html#escape-sequences) + +|Escape Sequence|Meaning| +|---|---| +|\|Backslash and newline ignored| +|\\ \\ |Backslash (\\)| +|\\'|Single quote (')| +|\\"|Double quote (")| +|\a|ASCII Bell (BEL)| +|\b|ASCII Backspace (BS)| +|\f|ASCII Formfeed (FF)| +|\n|ASCII Linefeed (LF)| +|\r|ASCII Carriage Return (CR)| +|\t|ASCII Horizontal Tab (TAB)| +|\v|ASCII Vertical Tab (VT)| +|\ooo|Character with octal value ooo| +|\xhh|Character with hex value hh| + +|Escape Sequence|Meaning| +|---|---| +|\N{name}| Character named name in the Unicode database> +|\uxxxx|Character with 16-bit hex value xxxx| +|\Uxxxxxxxx|Character with 32-bit hex value xxxxxxxx| + ## Reference * [Formatted String Literals](https://docs.python.org/3/tutorial/inputoutput.html#formatted-string-literals) * [Format Specification Mini-Language](https://docs.python.org/3/library/string.html#formatspec)