Skip to Content
Python Workout
book

Python Workout

by Reuven M. Lerner
July 2020
Beginner to intermediate
248 pages
6h 58m
English
Manning Publications
Content preview from Python Workout

2 Strings

Strings in Python are the way we work with text. Words, sentences, paragraphs, and even entire files are read into and manipulated via strings. Because so much of our work revolves around text, it’s no surprise that strings are one of the most common data types.

You should remember two important things about Python strings: (1) they’re immutable, and (2) in Python 3, they contain Unicode characters, encoded in UTF-8. (See the sidebars on each of these subjects.)

There’s no such thing as a “character” type in Python. We can talk about a “one-character string,” but that just means a string whose length is 1.

Python’s strings are interesting and useful, not only because they allow us to work with text, but also because they’re a Python ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Python for Programmers

Python for Programmers

Paul Deitel, Harvey Deitel
Python One-Liners

Python One-Liners

Christian Mayer

Publisher Resources

ISBN: 9781617295508Supplemental ContentPublisher SupportOtherPublisher WebsiteSupplemental ContentErrata PagePurchase Link