0

Python String question

Why does print(""" "Testing" """) work but print(" "Testing" ") not work? Also print(""" "Testing" """) only works if there is a space between """ and "Testing" ?

23rd Aug 2020, 3:15 PM
Sahiba Kaur
Sahiba Kaur - avatar
2 Answers
+ 3
You can put anything in triple quotes. Not single quotes, you need to escape those characters. And yup, the interpreter cant tell what youre doing, you have to be clear. """" could be " """, "" "", " """, """" or any other combo (I mean, i wrote that and it still looks confusing). The computer doesnt know so you just have to put it in right or use different quotes
23rd Aug 2020, 3:22 PM
Slick
Slick - avatar
+ 1
Thanks, that makes sense!
23rd Aug 2020, 3:23 PM
Sahiba Kaur
Sahiba Kaur - avatar