0

Why we can't use same type of quotes more than once

5th Jul 2017, 7:09 AM
kuldeep mewara
2 Answers
+ 4
When Python parser encounter one type of quote, it's like said to him: << hey: here start a string until the next same quote >>, so he continue reading watching for the same type of quote: if you reuse it without warning him that's not the end of the string, he will think so and will try to read next of your string as code to interpret, producing commonly syntax errors, or at least unexpected behaviours :P As @Ace explained, you can warn Python interpreter that you reuse the same type of quote by prefixing it with the back slash (\) character... (wich should be write twice so, if you want to have it as is in your string ^^)
5th Jul 2017, 10:38 AM
visph
visph - avatar