On this page
codecs.lookup
Prev: codecs.iterencode | Up: codecs | Next: codecs.lookup_error
Rel: codecs.backslashreplace_errors, codecs.Codec, codecs.CodecInfo, codecs.decode
Ref: docs.python.org — codecs.lookup
Tags: #public #python3 #stdlib #codecs
Import
import codecs
from codecs import lookup
Signature & Overview
codecs.lookup(encoding, /)
Looks up a codec tuple in the Python codec registry and returns a CodecInfo object.
Usage
import codecs
assert codecs.lookup("latin1").name == "iso8859-1"
assert codecs.lookup("utf8").name == "utf-8"
Gotchas
- Normalizes encoding aliases and raises
LookupErrorfor unknown names.
REPL Inspect
from codecs import lookup
help(lookup)
Linked from
Related notes
- tuts/python3/stdlib_module/codecs/iterencode Linked here; links to this page; shared tags: #codecs, #stdlib
- tuts/python3/stdlib_module/codecs/lookup_error Linked here; links to this page; shared tags: #codecs, #stdlib
- tuts/python3/stdlib_module/codecs Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/codecs/backslashreplace_errors Linked here; shared tags: #codecs, #stdlib
- tuts/python3/stdlib_module/codecs/Codec Linked here; shared tags: #codecs, #stdlib
- tuts/python3/stdlib_module/codecs/CodecInfo Linked here; shared tags: #codecs, #stdlib
- tuts/python3/stdlib_module/codecs/decode Linked here; shared tags: #codecs, #stdlib
- tuts/python3/stdlib_module/codecs/encode shared tags: #codecs, #stdlib
- tuts/python3/stdlib_module/codecs/EncodedFile shared tags: #codecs, #stdlib
- tuts/python3/stdlib_module/codecs/getdecoder shared tags: #codecs, #stdlib