Search⌘ K

Postscript: Character Encoding Of Python Source Code

Explore how Python 3 standardizes source code to UTF-8 encoding and understand how to specify different character encodings in your Python files. This lesson helps you master encoding declarations to ensure your Python code handles text correctly across environments.

We'll cover the following...

Python 3 assumes that your source code — i.e. each .py file — is encoded in UTF-8.

In Python 2, the default ...