On this page
  1. io.text_encoding
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

io.text_encoding

Prev: io.StringIO | Up: io | Next: io.TextIOBase
Rel: io.BlockingIOError, io.BufferedIOBase, io.BufferedRandom, io.BufferedReader
Ref: docs.python.org — io.text_encoding
Tags: #public #python3 #stdlib #io


Import

import io
from io import text_encoding

Signature & Overview

io.text_encoding(encoding, stacklevel=2, /)

A helper function to choose the text encoding.

Usage

import io

assert io.text_encoding(None) == "locale"
assert io.text_encoding("utf-8") == "utf-8"

Gotchas

REPL Inspect

from io import text_encoding
help(text_encoding)

Linked from

Related notes