Python Strings - thelastmile/FreeCodeCamp GitHub Wiki

Python Strings

Python allows str objects, or strings, to be expressed in a few different ways:

  • Single quotes: 'Single quote strings can have "double" quotes inside.'
  • Double quotes: "Double quote strings can have 'single' quotes inside."
  • Triple quoted:
    """Triple quoted strings can span multiple lines.
    Unescaped "double" and 'single' quotes in triple quoted strings are retained."""
    '''Triple quoted strings can be 'single'or "double" quotes.
    Unescaped newlines are also retained.'''

Reference:

Text Sequence Type str

Previous