0
what is the difference between>>>>> print('Hello') and print("Hello")
I am moving from Java and just wanted to learn something new during my break
3 Respuestas
+ 2
none,
well... there is:
If you have a word with an apostrophe like I'm in between ('...') then you'll have to write ('I'm') as ('I\'m'). That doesn't apply to double quotes so you can just write ("I'm").
If you have a quotation using single quotes inside of the ('...') then use \' again to denote that it's part of the string
If you have a quotation using double quotes inside of ('...') then no problems arise.
If you have a quotation using double quotes inside of ("...") then you should instead use ('...') or put \" for each
\' denotes that it's an apostrophe and not the end of the string, instead.
+ 1
print("Hello World, I'm God Usopp")
print('Hello World, I\'m God Usopp')
print('God Usopp said "Hello World" to the world')
print("God Usopp said \"Hello World\" to the world")
print('God Usopp\'s book \'Hello World\' is divine')
print("God Usopp's book 'Hello World' is divine")
print('Thanks God Usopp')
print("Thanks God Usopp")
- 2
single quotes is more related to single characters, and double quotes for whole strings...