How to add backslash | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

How to add backslash

21st Apr 2019, 9:53 AM
Micheal Tofunmi
Micheal Tofunmi - avatar
3 Respostas
+ 16
You can add a backslash by writing two backslashes \\. You can put a backslash character followed by a quote (\" or \'). This is called an escape sequence and Python will remove the backslash, and put just the quote in the string. So to print a backslash we need to add two continuous backslashes \\ Example : str1 = 'Solo' str2 = 'Learn' str3 = "Back\\Slash" print(str1+str2) # normal printing without backslash print(str1+"\\"+str2) # printing backslash print(str3) # printing a string with backslash
21st Apr 2019, 10:19 AM
Nova
Nova - avatar
+ 3
What do you mean by that? It should be on your keyboard. \
21st Apr 2019, 10:02 AM
Matthias
Matthias - avatar
+ 1
thank you
21st Apr 2019, 8:54 PM
Micheal Tofunmi
Micheal Tofunmi - avatar