What is diffrence between these two? Is it important? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is diffrence between these two? Is it important?

Type "d",'d' It gives: ('d', 'd') But "d"+'d' Gives 'dd'

28th Jul 2019, 9:15 PM
vahid dehghani
3 Answers
+ 1
I'd say that their only difference is, that you necessarily need to escape double quotes in double quote strings, and single quotes in single quote strings. " ' " Valid " " " Invalid " \" " Valid " \' " Valid ' " ' Valid ' ' ' Invalid ' \' ' Valid ' \" ' Valid
29th Jul 2019, 10:16 AM
Seb TheS
Seb TheS - avatar
+ 5
This is a contact of strings, they are glued together if in quotes.
28th Jul 2019, 9:20 PM
Anna/Аня
Anna/Аня - avatar
0
In Python, you can choose freely between ' and " - it both turns out as str.
28th Jul 2019, 10:39 PM
HonFu
HonFu - avatar