I just started a job where I'm writing Python after coming from a Java background, and I'm noticing that other developers tend to quote strings using single quotes ('') instead of double quotes (""). For example:

line1 = 'This is how strings typically look.'
line2 = "Not like this."


Is there a particular reason for this other than personal preference? Is this the proper way to be quoting strings? Specifically, what I want to know is if there is some type of standard or accepted best practice that drives this style of coding.

The other answers are correct in that it makes no technical difference, but I have seen one informal style rule on a couple of open-source projects: double quotes are used for strings that might eventually be visible to the user (whether or not they need translation), and single quotes are for strings that relate to the functionality of the code itself (eg. dict keys, regular expressions, SQL).

This is certainly not a universal rule (or even codified in a PEP), so like any other arbitrary aspect of coding it comes down to local rules.

Note that PEP 8 (which I hadn't noticed when I wrote this answer) says:


  This PEP does not make a recommendation for this. Pick a rule and stick to it. When a string contains single or double quote characters, however, use the other one to avoid backslashes in the string. It improves readability.


As a commenter points out, this isn't necessarily contradictory, depending on how you interpret "rule". What I suggest doesn't really work with the second half of the quote though.
