O'Reilly logo

Python Without Fear, First Edition by Brian Overland

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required