codecs.getdecoder()
codecs.getdecoder() is a Python function in the Codecs Module category. Returns the decoder function for the named codec. The syntax is codecs.getdecoder(encoding). Returns: Decoder function. A typical example: decoder = codecs.getdecoder("utf-8")
decoder(b"hello") # ("hello", 5). A close sibling is codecs.open(), which opens a file with a specific encoding. A close sibling is codecs.encode(), which encodes text to bytes using a named encoding. A close sibling is codecs.decode(), which decodes bytes to text using a named encoding. A close sibling is codecs.lookup(), which looks up a codec by name and returns a CodecInfo object. More about this category: Codec registry — open, encode, decode, lookup, getencoder. Related Codecs Module entries: codecs.open(), codecs.encode(), codecs.decode(), codecs.lookup(), codecs.getencoder(), codecs.EncodedFile(). This page is part of the free Python Reference documentation covering 978+ functions, methods, and modules with examples and parameter details. You can try codecs.getdecoder() immediately in the Python playground, look up unfamiliar terms in the glossary, or return to the Python Reference homepage.