0
' AND " difference?
pythn eg. >>> print('Hello world!') Hello world! Me 1 >>> print( " Hello world! " ) Hello world! Me 2 >>> print(' "Hello world! " ') "Hello world!" Me 3 >>> print( ' Hello world! ") SyntaxError: EOL while scanning string literal If ' and " are the same, why "Me 3" results Error? I don't want to tell my self that they look different or it is the rule...
4 ответов
+ 7
They aren't same. If you start from " then, you have to close it with this only.
See the following example:-
print(" ' ' ") # prints ' '
print(' " " ') # prints " "
If you will not close it with the same, it will give you an exception(EOL error)
+ 2
Lin Tzu
For the next time around, please put the relevant language in the thread tags to improve context clarity👌
+ 1
Thanks a lot!
+ 1
"EOL while scanning string literal" means thar the interpreter did not find the ending quote