What is escape charcter in python ( in detail ). | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is escape charcter in python ( in detail ).

22nd Jun 2019, 6:04 PM
Anas Siddique
Anas Siddique - avatar
2 Answers
+ 3
This is escape character: \ Do not confuse it to the division operator: / \ is only used in strings. You can use \ to declare special characters, such as tabs (\t), newlines (\n). You can use it to mark quotes to not be the border quotes of a string (\", \'). 'It\'s not so complicated.' "It is \"simple\"." You can even use escape character to escape another escape character from escaping a third character. "\\no \\newli\\nes are allowed." len("\n") = 1.
22nd Jun 2019, 9:11 PM
Seb TheS
Seb TheS - avatar
+ 2
https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2274/?ref=app Directly from SoloLearn: "Characters like these must be escaped by placing a backslash before them. Other common characters that must be escaped are newlines and backslashes. Double quotes only need to be escaped in double quote strings, and the same is true for single quote strings."
22nd Jun 2019, 6:16 PM
HNNX 🐿
HNNX 🐿 - avatar