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.

Ready To Learn To Code?

If you enjoyed the sample so far, then you can continue learning by Buying Learn Python 3 The Hard Way for 29.99. You'll receive all 52 exercises in PDF and HTML formats, plus 12 hours of 1080p teaching you each exercise. This course has helped 12 million people learn to code since 2010, so it can help you too. If you want to see more samples then try the Appendix A: Command Line Crash Course. If you already purchased this book then you can download the videos at your account page or view the paid HTML version.

Need To Learn For Free?

My Learn Ruby The Hard Way is still free to read for anyone who needs to learn to code. Ruby is a perfectly fine alternative to Python, and works just as well as a first language. If you can't afford Learn Python The Hard Way then read Learn Ruby The Hard Way for free.

Buy The Python 3 Edition!

When you buy Learn Python 3 The Hard Way, you'll receive the Python 3 Edition PDF, special access to a paid HTML version, and 12 hours of 1080p video, one video for each exercise. All files are DRM free and you can download them to your computer for offline viewing. Digital Download Only! You do not get a physical book.


Buy Digital Download From Zed

Try a a free sample of Learn Python the Hard Way right here, video lectures not included.

Other Buying Options

Buy on Amazon Buy from Barnes & Noble