Besides numbers, Python can also manipulate strings, which can be expressed in several ways. They can be enclosed in single quotes ('...') or double quotes ("...") with the same result.
In the interactive interpreter, the output string is enclosed in quotes and special characters are escaped with backslashes. While this might sometimes look different from the input (the enclosing quotes could change), the two strings are equivalent. The string is enclosed in double quotes if the string contains a single quote and no double quotes, otherwise it is enclosed in single quotes.
- Sequence Types — str, unicode, list, tuple, bytearray, buffer, xrange
- Strings, and the Unicode strings described in the next section, are examples of sequence types, and support the common operations supported by such types.
- String Methods
- Both strings and Unicode strings support a large number of methods for basic transformations and searching.
- String Formatting
- Information about string formatting with str.format() is described here.
- String Formatting Operations
- The old formatting operations invoked when strings and Unicode strings are the left operand of the % operator are described in more detail here.
June 9, 2017 at 09:52 am
Excellent on theory and practice. Taught carefully and thoughtfully from someone who clearly understands and works with Node in the real world. Tim never let any confusion pass by — if he says an unfamiliar word, he explains it. Worth much more than the $99I spent on it.