codecs.xmlcharrefreplace_errors()

codecs.xmlcharrefreplace_errors(exception) Implements the 'xmlcharrefreplace' error handling (for encoding with text encodings only): the unencodable character is replaced by an appropriate XML character reference.

codecs.strict_errors()

codecs.strict_errors(exception) Implements the 'strict' error handling: each encoding or decoding error raises a UnicodeError.

codecs.StreamWriter.writelines()

writelines(list) Writes the concatenated list of strings to the stream (possibly by reusing the write() method). The standard bytes-to-bytes codecs do not support this method.

codecs.StreamWriter.write()

write(object) Writes the object’s contents encoded to the stream.

codecs.StreamWriter.reset()

reset() Flushes and resets the codec buffers used for keeping state. Calling this method should ensure that the data on the output is put into a clean state that allows appending of new fresh data without having to rescan the whole stream to recover state.

codecs.StreamWriter

class codecs.StreamWriter(stream, errors='strict') Constructor for a StreamWriter instance. All stream writers must provide this constructor interface. They are free to add additional keyword arguments, but only the ones defined here are used by the Python codec registry. The stream argument must be a file-like object open for writing text or binary data, as appropriate for the specific codec. The StreamWriter may implement different error handling schemes by providing the errors keyword arg

codecs.StreamRecoder

class codecs.StreamRecoder(stream, encode, decode, Reader, Writer, errors) Creates a StreamRecoder instance which implements a two-way conversion: encode and decode work on the frontend — the data visible to code calling read() and write(), while Reader and Writer work on the backend — the data in stream. You can use these objects to do transparent transcodings from e.g. Latin-1 to UTF-8 and back. The stream argument must be a file-like object. The encode and decode arguments must adhere to

codecs.StreamReaderWriter

class codecs.StreamReaderWriter(stream, Reader, Writer, errors) Creates a StreamReaderWriter instance. stream must be a file-like object. Reader and Writer must be factory functions or classes providing the StreamReader and StreamWriter interface resp. Error handling is done in the same way as defined for the stream readers and writers.

codecs.StreamReader.reset()

reset() Resets the codec buffers used for keeping state. Note that no stream repositioning should take place. This method is primarily intended to be able to recover from decoding errors.

codecs.StreamReader.readlines()

readlines([sizehint[, keepends]]) Read all lines available on the input stream and return them as a list of lines. Line-endings are implemented using the codec’s decoder method and are included in the list entries if keepends is true. sizehint, if given, is passed as the size argument to the stream’s read() method.