No no. When a string contains a single quote, it is easier to enclose it in double quotes and vice versa. Other than that, my advice would be to choose a style and stick to it.
Another useful type of string literals are triple quotes, which can span multiple lines:
s = """string literal... ...continues on second line... ...and ends here"""
Again, you need to use single or double quotes for this.
Finally, I would like to mention "raw string literals". They are enclosed in r"..." or r'...' and do not allow the analysis of control sequences (for example, \n ) as such. Among other things, the original string literals are very convenient for specifying regular expressions.
Read more about Python string literals here .
source share