Escape Sequences in Python
\n - Newline: Moves to the next line.
Example: print('Hello\nWorld') -> Output:
Hello
World
\t - Horizontal Tab: Inserts a tab space.
Example: print('Hello\tWorld') -> Output: Hello World
\\ - Backslash: Prints a backslash.
Example: print('This is a \\') -> Output: This is a \
\' - Single Quote: Inserts a single quote.
Example: print('It\'s sunny') -> Output: It's sunny
\" - Double Quote: Inserts a double quote.
Example: print('He said, \"Hi\"') -> Output: He said, "Hi"
\r - Carriage Return: Moves the cursor to the beginning of the line.
Example: print('Hello\rWorld') -> Output: World
\b - Backspace: Removes the previous character.
Example: print('Helloo\b') -> Output: Hello
\f - Form Feed: Advances to the next page in printers.
Example: print('Hello\fWorld')
\a - Bell/Alert: Triggers a sound (if supported by the system).
Example: print('\a')
\v - Vertical Tab: Inserts a vertical tab.
Example: print('Hello\vWorld')
\0 - Null Character: Represents a null character.
Example: print('Hello\0World') -> Output: Hello World
Raw String Prefix (r): Treats backslashes as literal characters.
Example: print(r'Hello\nWorld') -> Output: Hello\nWorld