6. Strings

After numbers, strings are the most important data type in Python. Strings are ubiquitous: You print them to the screen, you read them from the user, and as we will see in Chapter 8, files are often treated as big strings. The World Wide Web can be thought of as a collection of webpages, most of which consist of text.

Strings are an example of an aggregate data structure, and they provide our first look at indexing and slicing—techniques that are used to extract substrings from strings.

The chapter also contains a brief introduction to Python’s regular expression library, which is a supercharged mini-language designed for processing ...

Get Python: Visual QuickStart Guide, Third 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.