Exercise 23. Strings, Bytes, and Character Encodings

To do this exercise you’ll need to download a text file that I’ve written named languages.txt (https://learnpythonthehardway.org/python3/languages.txt). This file was created with a list of human languages to demonstrate a few interesting concepts:

1. How modern computers store human languages for display and processing and how Python 3 calls this strings

2. How you must “encode” and “decode” Python’s strings into a type called bytes

3. How to handle errors in your string and byte handling

4. How to read code and find out what it means even if you’ve never seen it before

In addition to that you’ll also get a brief glimpse of the Python 3 if-statement and lists for processing a list of things. ...

Get Learn Python 3 the Hard Way: A Very Simple Introduction to the Terrifyingly Beautiful World of Computers and Code 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.