On this page
  1. codecs.IncrementalEncoder
  2. Import
  3. Signature & Overview
  4. Methods & Attributes
  5. Usage
  6. Gotchas
  7. REPL Inspect

codecs.IncrementalEncoder

Prev: codecs.IncrementalDecoder | Up: codecs | Next: codecs.iterdecode
Rel: codecs.backslashreplace_errors, codecs.Codec, codecs.CodecInfo, codecs.decode
Ref: docs.python.org — codecs.IncrementalEncoder
Tags: #public #python3 #stdlib #codecs


Import

import codecs
from codecs import IncrementalEncoder

Signature & Overview

codecs.IncrementalEncoder(errors='strict')

An IncrementalEncoder encodes an input in multiple steps. The input can be passed piece by piece to the encode() method. The IncrementalEncoder remembers the state of the encoding process between calls to encode().

Methods & Attributes

Usage

import codecs

enc = codecs.getincrementalencoder("utf-16")()
out = enc.encode("a", final=False) + enc.encode("b", final=True)
assert out.decode("utf-16") == "ab"

Gotchas

REPL Inspect

from codecs import IncrementalEncoder
help(IncrementalEncoder)

Linked from

Related notes