2. Advanced String Capabilities

How does a computer communicate messages to humans? Through hand-waving, smoke signals, or (as in sci-fi movies of the 1950s) a blinking red light?

No. Even programs that utilize voice or voice recognition (somewhat outside the scope of this book) depend on groups of printable characters called text strings, or just strings. Every programmer needs to manage the art of prompting for, searching, and printing these strings. Fortunately, Python excels at this task.

Even if you’ve used Python text strings before, you’ll likely want to peruse this chapter to make sure that you’re using all the built-in capabilities of Python strings.

2.1 Strings Are Immutable

Data types in Python are either mutable (changeable) or ...

Get Supercharged Python: Take Your Code to the Next Level, First Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.