codecs.escape_decode()
codecs.escape_decode() is a Python function in the Codecs Module category. Decodes escape sequences like \n, \xhh in bytes. The syntax is codecs.escape_decode(data). Returns: (decoded_bytes, length) tuple. A typical example: codecs.escape_decode(b"hello\\nworld") # (b"hello\nworld", 13). 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.getdecoder(). 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.escape_decode() immediately in the Python playground, look up unfamiliar terms in the glossary, or return to the Python Reference homepage.