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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.