codecs.decode()
codecs.decode() is a Python function in the Codecs Module category. Decodes bytes to text using a named encoding. The syntax is codecs.decode(obj, encoding="utf-8", errors="strict"). Returns: String. A typical example: codecs.decode(b"hello", "utf-8") # "hello". 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.lookup(), which looks up a codec by name and returns a CodecInfo object. A close sibling is codecs.getencoder(), which returns the encoder function for the named codec. More about this category: Codec registry — open, encode, decode, lookup, getencoder. Related Codecs Module entries: codecs.open(), codecs.encode(), codecs.lookup(), codecs.getencoder(), codecs.getdecoder(), 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.decode() immediately in the Python playground, look up unfamiliar terms in the glossary, or return to the Python Reference homepage.