<p>According to the documentation, they're pretty much interchangeable.  Is there a stylistic reason to use one over the other?</p>

[{'answer_id': 56025, 'author': 'Vinko Vrsalovic', 'author_id': 5190, 'author_profile': 'https://Stackoverflow.com/users/5190', 'pm_score': 0, 'selected': False, 'text': "<p>Your team's taste or your project's coding guidelines.</p>\n\n<p>If you are in a multilanguage environment, you might wish to encourage the use of the same type of quotes for strings that the other language uses, for instance. Else, I personally like best the look of '</p>\n"}, {'answer_id': 56029, 'author': 'Mario F', 'author_id': 3785, 'author_profile': 'https://Stackoverflow.com/users/3785', 'pm_score': 0, 'selected': False, 'text': '<p>None as far as I know. Although if you look at some code, " " is commonly used for strings of text (I guess \' is more common inside text than "), and \' \' appears in hashkeys and things like that.</p>\n'}, {'answer_id': 56041, 'author': 'Tony Meyer', 'author_id': 4966, 'author_profile': 'https://Stackoverflow.com/users/4966', 'pm_score': 5, 'selected': False, 'text': '<p>If the string you have contains one, then you should use the other.  For example, <code>"You\'re able to do this"</code>, or <code>\'He said "Hi!"\'</code>.  Other than that, you should simply be as consistent as you can (within a module, within a package, within a project, within an organisation).</p>\n\n<p>If your code is going to be read by people who work with C/C++ (or if you switch between those languages and Python), then using <code>\'\'</code> for single-character strings, and <code>""</code> for longer strings might help ease the transition.  (Likewise for following other languages where they are not interchangeable).</p>\n\n<p>The Python code I\'ve seen in the wild tends to favour <code>"</code> over <code>\'</code>, but only slightly.  The one exception is that <code>"""these"""</code> are much more common than <code>\'\'\'these\'\'\'</code>, from what I have seen.</p>\n'}, {'answer_id': 56047, 'author': 'Matt Sheppard', 'author_id': 797, 'author_profile': 'https://Stackoverflow.com/users/797', 'pm_score': 2, 'selected': False, 'text': "<p>I use double quotes in general, but not for any specific reason - Probably just out of habit from Java.</p>\n\n<p>I guess you're also more likely to want apostrophes in an inline literal string than you are to want double quotes.</p>\n"}, {'answer_id': 56073, 'author': 'Daren Thomas', 'author_id': 2260, 'author_profile': 'https://Stackoverflow.com/users/2260', 'pm_score': 7, 'selected': False, 'text': '<p>I used to prefer <code>\'</code>, especially for <code>\'\'\'docstrings\'\'\'</code>, as I find <code>"""this creates some fluff"""</code>. Also, <code>\'</code> can be typed without the <kbd>Shift</kbd> key on my Swiss German keyboard.</p>\n\n<p>I have since changed to using triple quotes for <code>"""docstrings"""</code>, to conform to <a href="http://www.python.org/dev/peps/pep-0257/" rel="nofollow noreferrer">PEP 257</a>.</p>\n'}, {'answer_id': 56190, 'author': 'Will Harris', 'author_id': 4702, 'author_profile': 'https://Stackoverflow.com/users/4702', 'pm_score': 10, 'selected': True, 'text': '<p>I like to use double quotes around strings that are used for interpolation or that are natural language messages, and single quotes for small symbol-like strings, but will break the rules if the strings contain quotes, or if I forget. I use triple double quotes for docstrings and raw string literals for regular expressions even if they aren\'t needed.</p>\n\n<p>For example:</p>\n\n<pre><code>LIGHT_MESSAGES = {\n    \'English\': "There are %(number_of_lights)s lights.",\n    \'Pirate\':  "Arr! Thar be %(number_of_lights)s lights."\n}\n\ndef lights_message(language, number_of_lights):\n    """Return a language-appropriate string reporting the light count."""\n    return LIGHT_MESSAGES[language] % locals()\n\ndef is_pirate(message):\n    """Return True if the given message sounds piratical."""\n    return re.search(r"(?i)(arr|avast|yohoho)!", message) is not None\n</code></pre>\n'}, {'answer_id': 56210, 'author': 'Garth Kidd', 'author_id': 5700, 'author_profile': 'https://Stackoverflow.com/users/5700', 'pm_score': 5, 'selected': False, 'text': "<p>I'm with Will: </p>\n\n<ul>\n<li>Double quotes for text</li>\n<li>Single quotes for anything that behaves like an identifier</li>\n<li>Double quoted raw string literals for regexps</li>\n<li>Tripled double quotes for docstrings</li>\n</ul>\n\n<p>I'll stick with that even if it means a lot of escaping. </p>\n\n<p>I get the most value out of single quoted identifiers standing out because of the quotes. The rest of the practices are there just to give those single quoted identifiers some standing room. </p>\n"}, {'answer_id': 104842, 'author': 'Mike', 'author_id': 19215, 'author_profile': 'https://Stackoverflow.com/users/19215', 'pm_score': 2, 'selected': False, 'text': "<p>It's probably a stylistic preference more than anything.  I just checked PEP 8 and didn't see any mention of single versus double quotes.</p>\n\n<p>I prefer single quotes because its only one keystroke instead of two.  That is, I don't have to mash the shift key to make single quote.</p>\n"}, {'answer_id': 144163, 'author': 'conny', 'author_id': 23023, 'author_profile': 'https://Stackoverflow.com/users/23023', 'pm_score': 7, 'selected': False, 'text': '<p>Quoting the official docs at <a href="https://docs.python.org/2.0/ref/strings.html" rel="noreferrer">https://docs.python.org/2.0/ref/strings.html</a>:</p>\n\n<blockquote>\n  <p>In plain English: String literals can be enclosed in matching single quotes (\') or double quotes (").</p>\n</blockquote>\n\n<p>So there is no difference. Instead, people will tell you to choose whichever style that matches the context, <em>and to be consistent</em>. And I would agree - adding that it is pointless to try to come up with "conventions" for this sort of thing because you\'ll only end up confusing any newcomers.</p>\n'}, {'answer_id': 145149, 'author': 'schwa', 'author_id': 23113, 'author_profile': 'https://Stackoverflow.com/users/23113', 'pm_score': 2, 'selected': False, 'text': "<p>Personally I stick with one or the other. It doesn't matter. And providing your own meaning to either quote is just to confuse other people when you collaborate.</p>\n"}, {'answer_id': 629106, 'author': 'Andrew Dalke', 'author_id': 64618, 'author_profile': 'https://Stackoverflow.com/users/64618', 'pm_score': 1, 'selected': False, 'text': '<p>I chose to use double quotes because they are easier to see.</p>\n'}, {'answer_id': 1167795, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 1, 'selected': False, 'text': "<p>I just use whatever strikes my fancy at the time; it's convenient to be able to switch between the two at a whim!</p>\n\n<p>Of course, when quoting quote characetrs, switching between the two might not be so whimsical after all...</p>\n"}, {'answer_id': 1209191, 'author': 'jblocksom', 'author_id': 20626, 'author_profile': 'https://Stackoverflow.com/users/20626', 'pm_score': 4, 'selected': False, 'text': '<p>Triple quoted comments are an interesting subtopic of this question. <a href="http://www.python.org/dev/peps/pep-0257/" rel="noreferrer">PEP 257 specifies triple quotes for doc strings</a>. I did a quick check using Google Code Search and found that <a href="http://www.google.com/codesearch?hl=en&amp;lr=&amp;q=lang%3Apython+%22%22%22" rel="noreferrer">triple double quotes in Python</a> are about 10x as popular as <a href="http://www.google.com/codesearch?hl=en&amp;lr=&amp;q=lang%3Apython+%27%27%27" rel="noreferrer">triple single quotes</a> -- 1.3M vs 131K occurrences in the code Google indexes. So in the multi line case your code is probably going to be more familiar to people if it uses triple double quotes.</p>\n'}, {'answer_id': 2091077, 'author': 'kn3l', 'author_id': 128618, 'author_profile': 'https://Stackoverflow.com/users/128618', 'pm_score': -1, 'selected': False, 'text': '<p><code>\'</code> = <code>"</code></p>\n\n<p><code>/</code> = <code>\\</code> = <code>\\\\</code></p>\n\n<p>example :  </p>\n\n<pre><code>f = open(\'c:\\word.txt\', \'r\')\nf = open("c:\\word.txt", "r")\nf = open("c:/word.txt", "r")\nf = open("c:\\\\\\word.txt", "r")\n</code></pre>\n\n<p>Results are the same</p>\n\n<p>=>> no, they\'re not the same.\nA single backslash will escape characters. You just happen to luck out in that example because <code>\\k</code> and <code>\\w</code> aren\'t valid escapes like <code>\\t</code> or <code>\\n</code> or <code>\\\\</code> or <code>\\"</code></p>\n\n<p>If you want to use single backslashes (and have them interpreted as such), then you need to use a "raw" string. You can do this by putting an \'<code>r</code>\' in front of the string</p>\n\n<pre><code>im_raw = r\'c:\\temp.txt\'\nnon_raw = \'c:\\\\temp.txt\'\nanother_way = \'c:/temp.txt\'\n</code></pre>\n\n<p>As far as paths in Windows are concerned, forward slashes are interpreted the same way. Clearly the string itself is different though. I wouldn\'t guarantee that they\'re handled this way on an external device though.</p>\n'}, {'answer_id': 3179568, 'author': 'Peterino', 'author_id': 202834, 'author_profile': 'https://Stackoverflow.com/users/202834', 'pm_score': 2, 'selected': False, 'text': "<blockquote>\n  <p>In Perl you want to use single quotes when you have a string which doesn't need to interpolate variables or escaped characters like \\n, \\t, \\r, etc.</p>\n</blockquote>\n\n<p>PHP makes the same distinction as Perl: content in single quotes will not be interpreted (not even \\n will be converted), as opposed to double quotes which can contain variables to have their value printed out.</p>\n\n<p>Python does not, I'm afraid. Technically seen, there is no $ token (or the like) to separate a name/text from a variable in Python. Both features make Python more readable, less confusing, after all. Single and double quotes can be used interchangeably in Python.</p>\n"}, {'answer_id': 3179675, 'author': 'Philipp', 'author_id': 178761, 'author_profile': 'https://Stackoverflow.com/users/178761', 'pm_score': -1, 'selected': False, 'text': "<p>I use double quotes because I have been doing so for years in most languages (C++, Java, VB…) except Bash, because I also use double quotes in normal text and because I'm using a (modified) non-English keyboard where both characters require the shift key.</p>\n"}, {'answer_id': 4776742, 'author': 'Michael', 'author_id': 584811, 'author_profile': 'https://Stackoverflow.com/users/584811', 'pm_score': 3, 'selected': False, 'text': '<p>Python uses quotes something like this:</p>\n\n<pre class="lang-py prettyprint-override"><code>mystringliteral1="this is a string with \'quotes\'"\nmystringliteral2=\'this is a string with "quotes"\'\nmystringliteral3="""this is a string with "quotes" and more \'quotes\'"""\nmystringliteral4=\'\'\'this is a string with \'quotes\' and more "quotes"\'\'\'\nmystringliteral5=\'this is a string with \\"quotes\\"\'\nmystringliteral6=\'this is a string with \\042quotes\\042\'\nmystringliteral6=\'this is a string with \\047quotes\\047\'\n\nprint mystringliteral1\nprint mystringliteral2\nprint mystringliteral3\nprint mystringliteral4\nprint mystringliteral5\nprint mystringliteral6\n</code></pre>\n\n<p>Which gives the following output:</p>\n\n<pre class="lang-none prettyprint-override"><code>this is a string with \'quotes\'\nthis is a string with "quotes"\nthis is a string with "quotes" and more \'quotes\'\nthis is a string with \'quotes\' and more "quotes"\nthis is a string with "quotes"\nthis is a string with \'quotes\'\n</code></pre>\n'}, {'answer_id': 7514799, 'author': 'yurisich', 'author_id': 881224, 'author_profile': 'https://Stackoverflow.com/users/881224', 'pm_score': 4, 'selected': False, 'text': '<pre><code>"If you\'re going to use apostrophes, \n       ^\n\nyou\'ll definitely want to use double quotes".\n   ^\n</code></pre>\n\n<p>For that simple reason, I always use double quotes on the outside. <em>Always</em></p>\n\n<p>Speaking of fluff, what good is streamlining your string literals with \' if you\'re going to have to use escape characters to represent apostrophes? Does it offend coders to read novels? I can\'t imagine how painful high school English class was for you!</p>\n'}, {'answer_id': 16048319, 'author': 'Asclepius', 'author_id': 832230, 'author_profile': 'https://Stackoverflow.com/users/832230', 'pm_score': 0, 'selected': False, 'text': '<p>I aim to minimize both pixels and surprise. I typically prefer <code>\'</code> in order to minimize pixels, but <code>"</code> instead if the string has an apostrophe, again to minimize pixels. For a docstring, however, I prefer <code>"""</code> over <code>\'\'\'</code> because the latter is non-standard, uncommon, and therefore surprising. If now I have a bunch of strings where I used <code>"</code> per the above logic, but also one that can get away with a <code>\'</code>, I may still use <code>"</code> in it to preserve consistency, only to minimize surprise.</p>\n\n<p>Perhaps it helps to think of the pixel minimization philosophy in the following way. Would you rather that English characters looked like <code>A B C</code> or <code>AA BB CC</code>? The latter choice wastes 50% of the non-empty pixels.</p>\n'}]
['https://Stackoverflow.com/questions/56011', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4883/']