+ 4

Difference between ' and " ?

so these tutorials I'm going through seem to use ' and " (single and double quotes) interchangeably when dealing with strings. I know there is a difference in C, but does it matter for Python? if it was explained anywhere, I missed it. Thanks!

5th Jun 2017, 10:09 PM
Optix334
Optix334 - avatar
6 Antworten
+ 17
Nope, no difference. You may use them alternatively, if you need to enclose an apostrophe or quotes and don't want to escape them. So both: print("Let's go!") and print('She said: "Go away!" and left.') will be fine.
5th Jun 2017, 10:16 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 4
definitely noooooo difference!!! but if you wanna print sth in python you can use ' in the text if you used " for the text definition...
6th Jun 2017, 3:23 PM
Ali Abolhassanzadeh Mahani
Ali Abolhassanzadeh Mahani - avatar
+ 3
" / ' = 2 😉
6th Jun 2017, 12:23 AM
Danil Tarakanov
Danil Tarakanov - avatar
+ 2
If you use one, you can output the other without a backslash, there isn't another differences I think
6th Jun 2017, 1:46 AM
Andrés04_ve
Andrés04_ve - avatar
0
' and " are interchangeable in Python, both can be use without giving an error
7th Jun 2017, 7:57 PM
Amit Gupta
Amit Gupta - avatar