O'Reilly logo

Python 3 Object Oriented Programming by Dusty Phillips

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 10. Files and Strings

Let's take a step back from the higher-level patterns now, and cover several Python constructs we've used in all our examples, but without any details. We'll be looking at files, IO, and serializing and loading data. Along the way, we'll find out how complicated Python's excessively simple strings really are. In particular, we'll see:

  • The complexities of strings, bytes, and byte array
  • The ins and outs of string formatting
  • How to open files
  • Context managers
  • A few ways to serialize data

Strings

Strings are a basic primitive in Python; we've used them in nearly every example we've discussed so far. All they do is represent an immutable sequence of characters. Of course, "character" is a bit of an ambiguous word; can Python ...

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