3
Is there any difference between a string declared with single quotes '
a = 'Special cases aren\'t special enough to break the rules.'
and one with double quotes "
b = "Special cases aren't special enough to break the rules."
or even with multiple double quotes """
c = """Special cases aren't special enough to break the rules."""
or simple '''
d = '''Special cases aren't special enough to break the rules.'''
in Python? In a practical way, there seems to be no difference in these four expressions, see at Ideone.
Is there a difference? Are there cases where any of the options would be preferable? Why?
That’s a question that has an answer in English and was closed because it was considered "Not constructive".
– Sidon
If you don’t misread your question, why not also add to the question the strings defined with three single quotes and three double quotes? For example:
a = """teste"""
– Woss
I voted to reopen the question because I believe that the question marked as duplicate does not really answer the current question. The difference between char and string in Python and commented that both define a string, but nothing is said (nor is part of the scope of that question) about the differences between all statements of string.
– Woss
@Andersoncarloswoss also believe not, +1 a vote to reopen.
– Guilherme Nascimento
Related: How to write multiple lines in Python?
– Guilherme Nascimento