Strings in practice.
WHAT A STRING IS
A sequence of characters, in quotes.
COMMON OPERATIONS
Joining Splitting on a separator Changing case Removing surrounding whitespace Replacing part of it Checking whether it contains something
THE WHITESPACE POINT
Text from files and user input frequently carries spaces at the ends.
Stripping it prevents a large class of comparison failures.
FORMATTING VALUES INTO TEXT
Modern Python provides a concise way to insert values into a string.
Use it rather than joining pieces manually.
WHY
It is clearer and less error-prone.
WHAT TO BE CAREFUL WITH
Comparing text with differing case Comparing text with hidden whitespace Assuming a value is text when it is a number
CHARACTERS BEYOND THE BASIC SET
Python 3 handles international characters properly.
Problems usually come from files, not from Python.
WHAT TO DO ABOUT THOSE
Specify the encoding when reading and writing files.
WHAT TO PREFER
Built-in string methods over writing your own.