How to include \ as part of your string? Example : "martin\" prints martin\\. How do yoo make it print martin\ | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
0

How to include \ as part of your string? Example : "martin\" prints martin\\. How do yoo make it print martin\

18th Dec 2016, 9:55 PM
Akshata
3 Respuestas
+ 3
Only since you have not covered it yet: ' = " / = \ = \\ >>>print 'this won't print the whole string' to include ' in words there are two ways... either >>>print "this can't fail" or >>>print 'this won\'t fail either' - this is not used often but a backslash serves the same function as \\martin in strings as " \' ". Dr.
19th Dec 2016, 1:40 AM
Tristan McCullen
Tristan McCullen - avatar
+ 1
did you try to type double backslash? "martin\\" since backslash is used in escape-characters, there must be a way to use it as a symbol. and it's easily made by escaping it with another backslash.
18th Dec 2016, 10:52 PM
Demeth
Demeth - avatar
+ 1
Martin\\ worked - thank you
18th Dec 2016, 10:55 PM
Akshata