7. Python Strings

Computer programs do more than crunch numbers. They communicate with the end user. This is what text strings are for: they contain human-readable information made up of printable characters. One of the most important tasks of programs is tokenization—breaking down a line of input into individual words.

In this chapter, we’re going to get inside of strings and show how to efficiently pull them apart and put them together.

Image Counting characters

Image Stripping trailing and leading spaces

Splitting lines of input (tokenization)

Building ...

Get Python Without Fear 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.