Video Pending

Created by Zed A. Shaw Updated 2024-02-17 04:54:36
 

22: Strings, Bytes, and Character Encodings

To do this exercise you'll need to download a text file that I've written named 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.

You can get this file by doing Right Click with your mouse and selecting "Download" to download the file reliably. Use this link https://learnpythonthehardway.org/python3/languages.txt to download the file.

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. You don't have to master this code or understand these concepts right away. You'll get plenty of practice in later exercises. For now your job is to get a taste of the future and learn the four topics in the preceding list.

This exercise is hard! There's a lot of information in it that you need to understand, and it's information that goes deep into computers. This exercise is complex because Python's strings are complex and difficult to use. I recommend you take this exercise painfully slow. Write down every word you don't understand, and look it up or research it. Take a paragraph at a time if you must. You can continue with other exercises while you study this one, so don't get stuck here. Just chip away at it for as long as it takes.
Previous Lesson Next Lesson

Register for Learn Python the Hard Way, 5th Edition (2023-2024)

Register today for the course and get the all currently available videos and lessons, plus all future modules for no extra charge.