Possible Duplicate:
Single quotes vs. double quotes in Python
Usually we represent , create strings like this
s = 'abc'
and also like this
c = "abc"
Ideally both ways are same , than why we have two syntax to do the same ? Is there any difference between these two or Ideally they are same.
The are essentially the same, except for what you have to escape:
both work, but to incorporate multiple quote types you must escape the ones used to create the string:
The two exist to make it easy for you to avoid having to escape your quotes, so the following two are easy:
Note that there are also tripple-quote variants:
These also allow newlines to be included without escaping:
That last example would require you to use excessive
\nescape sequences otherwise.