escape sequence (Escape Character)
escape sequence
Escape Character
If you are studying a language when you are a beginner, you may suffer from backslash. Therefore, backslash is a character that can be used in combination. Also, depending on the escape character, the function is different.
| Escape Character | Explanation |
|---|---|
| \n | line break |
| \t | tab |
| \v | vertical tab |
| \b | backspace |
| \f | form feed (line break, move the cursor to the next line) |
| \r | carriage return (line break, move the cursor forward) |
| \a | ringtone (warning) |
| ' | single quote |
| " | double quotes |
| \ \ | \ |
| \000 | ASCII characters in octal notation (null character) |
| \ ? | literal question mark |
| \ hh | ASCII characters in hexadecimal notation |
| \ hhhh | A Unicode character in hexadecimal notation when this escape sequence is used in a wide-character constant or Unicode string literal. |
| *** |
Not many, but I’ll show you a few examples.
print("Hello World!")
Hello World!
print("Hello\nWorld!") # \n line break
Hello
World!
print("Hello\tWorld!") # \t tab
Hello World!
print("H\bello World!") # \b backspace
ello World!
print("\000") # \000 null character
print("\\Hello World!\\") # \\ '\'
\Hello World!\
댓글남기기