O'Reilly logo

A Concise Introduction to Programming in Python by Mark J. Johnson

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

Chapter 11

Strings

Strings are a basic data type in Python; the others you have seen so far are integer, float, and boolean. Each data type stores its information in a different way and supports a different set of operations. Whereas integers, floats, and booleans are each single pieces of data, strings provide our first example of a data structure, which is a collection of data organized to efficiently support a particular set of access methods and operations.

A Python string is a sequence of characters inside quotation marks, either single () or double ("). Python also uses a form of triple quotes that you can read about in the documentation. We used strings in Listing 2.1, as well as in print() and input() expressions; now it is time to dig ...

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