doc_content
stringlengths
1
386k
doc_id
stringlengths
5
188
cmath.sqrt(x) Return the square root of x. This has the same branch cut as log().
python.library.cmath#cmath.sqrt
cmath.tan(x) Return the tangent of x.
python.library.cmath#cmath.tan
cmath.tanh(x) Return the hyperbolic tangent of x.
python.library.cmath#cmath.tanh
cmath.tau The mathematical constant τ, as a float. New in version 3.6.
python.library.cmath#cmath.tau
cmd — Support for line-oriented command interpreters Source code: Lib/cmd.py The Cmd class provides a simple framework for writing line-oriented command interpreters. These are often useful for test harnesses, administrative tools, and prototypes that will later be wrapped in a more sophisticated interface. class cmd...
python.library.cmd
class cmd.Cmd(completekey='tab', stdin=None, stdout=None) A Cmd instance or subclass instance is a line-oriented interpreter framework. There is no good reason to instantiate Cmd itself; rather, it’s useful as a superclass of an interpreter class you define yourself in order to inherit Cmd’s methods and encapsulate a...
python.library.cmd#cmd.Cmd
Cmd.cmdloop(intro=None) Repeatedly issue a prompt, accept input, parse an initial prefix off the received input, and dispatch to action methods, passing them the remainder of the line as argument. The optional argument is a banner or intro string to be issued before the first prompt (this overrides the intro class at...
python.library.cmd#cmd.Cmd.cmdloop
Cmd.cmdqueue A list of queued input lines. The cmdqueue list is checked in cmdloop() when new input is needed; if it is nonempty, its elements will be processed in order, as if entered at the prompt.
python.library.cmd#cmd.Cmd.cmdqueue
Cmd.completedefault(text, line, begidx, endidx) Method called to complete an input line when no command-specific complete_*() method is available. By default, it returns an empty list.
python.library.cmd#cmd.Cmd.completedefault
Cmd.default(line) Method called on an input line when the command prefix is not recognized. If this method is not overridden, it prints an error message and returns.
python.library.cmd#cmd.Cmd.default
Cmd.doc_header The header to issue if the help output has a section for documented commands.
python.library.cmd#cmd.Cmd.doc_header
Cmd.emptyline() Method called when an empty line is entered in response to the prompt. If this method is not overridden, it repeats the last nonempty command entered.
python.library.cmd#cmd.Cmd.emptyline
Cmd.identchars The string of characters accepted for the command prefix.
python.library.cmd#cmd.Cmd.identchars
Cmd.intro A string to issue as an intro or banner. May be overridden by giving the cmdloop() method an argument.
python.library.cmd#cmd.Cmd.intro
Cmd.lastcmd The last nonempty command prefix seen.
python.library.cmd#cmd.Cmd.lastcmd
Cmd.misc_header The header to issue if the help output has a section for miscellaneous help topics (that is, there are help_*() methods without corresponding do_*() methods).
python.library.cmd#cmd.Cmd.misc_header
Cmd.onecmd(str) Interpret the argument as though it had been typed in response to the prompt. This may be overridden, but should not normally need to be; see the precmd() and postcmd() methods for useful execution hooks. The return value is a flag indicating whether interpretation of commands by the interpreter shoul...
python.library.cmd#cmd.Cmd.onecmd
Cmd.postcmd(stop, line) Hook method executed just after a command dispatch is finished. This method is a stub in Cmd; it exists to be overridden by subclasses. line is the command line which was executed, and stop is a flag which indicates whether execution will be terminated after the call to postcmd(); this will be...
python.library.cmd#cmd.Cmd.postcmd
Cmd.postloop() Hook method executed once when cmdloop() is about to return. This method is a stub in Cmd; it exists to be overridden by subclasses.
python.library.cmd#cmd.Cmd.postloop
Cmd.precmd(line) Hook method executed just before the command line line is interpreted, but after the input prompt is generated and issued. This method is a stub in Cmd; it exists to be overridden by subclasses. The return value is used as the command which will be executed by the onecmd() method; the precmd() implem...
python.library.cmd#cmd.Cmd.precmd
Cmd.preloop() Hook method executed once when cmdloop() is called. This method is a stub in Cmd; it exists to be overridden by subclasses.
python.library.cmd#cmd.Cmd.preloop
Cmd.prompt The prompt issued to solicit input.
python.library.cmd#cmd.Cmd.prompt
Cmd.ruler The character used to draw separator lines under the help-message headers. If empty, no ruler line is drawn. It defaults to '='.
python.library.cmd#cmd.Cmd.ruler
Cmd.undoc_header The header to issue if the help output has a section for undocumented commands (that is, there are do_*() methods without corresponding help_*() methods).
python.library.cmd#cmd.Cmd.undoc_header
Cmd.use_rawinput A flag, defaulting to true. If true, cmdloop() uses input() to display a prompt and read the next command; if false, sys.stdout.write() and sys.stdin.readline() are used. (This means that by importing readline, on systems that support it, the interpreter will automatically support Emacs-like line edi...
python.library.cmd#cmd.Cmd.use_rawinput
code — Interpreter base classes Source code: Lib/code.py The code module provides facilities to implement read-eval-print loops in Python. Two classes and convenience functions are included which can be used to build applications which provide an interactive interpreter prompt. class code.InteractiveInterpreter(local...
python.library.code
code.compile_command(source, filename="<input>", symbol="single") This function is useful for programs that want to emulate Python’s interpreter main loop (a.k.a. the read-eval-print loop). The tricky part is to determine when the user has entered an incomplete command that can be completed by entering more text (as ...
python.library.code#code.compile_command
code.interact(banner=None, readfunc=None, local=None, exitmsg=None) Convenience function to run a read-eval-print loop. This creates a new instance of InteractiveConsole and sets readfunc to be used as the InteractiveConsole.raw_input() method, if provided. If local is provided, it is passed to the InteractiveConsole...
python.library.code#code.interact
class code.InteractiveConsole(locals=None, filename="<console>") Closely emulate the behavior of the interactive Python interpreter. This class builds on InteractiveInterpreter and adds prompting using the familiar sys.ps1 and sys.ps2, and input buffering.
python.library.code#code.InteractiveConsole
InteractiveConsole.interact(banner=None, exitmsg=None) Closely emulate the interactive Python console. The optional banner argument specify the banner to print before the first interaction; by default it prints a banner similar to the one printed by the standard Python interpreter, followed by the class name of the c...
python.library.code#code.InteractiveConsole.interact
InteractiveConsole.push(line) Push a line of source text to the interpreter. The line should not have a trailing newline; it may have internal newlines. The line is appended to a buffer and the interpreter’s runsource() method is called with the concatenated contents of the buffer as source. If this indicates that th...
python.library.code#code.InteractiveConsole.push
InteractiveConsole.raw_input(prompt="") Write a prompt and read a line. The returned line does not include the trailing newline. When the user enters the EOF key sequence, EOFError is raised. The base implementation reads from sys.stdin; a subclass may replace this with a different implementation.
python.library.code#code.InteractiveConsole.raw_input
InteractiveConsole.resetbuffer() Remove any unhandled source text from the input buffer.
python.library.code#code.InteractiveConsole.resetbuffer
class code.InteractiveInterpreter(locals=None) This class deals with parsing and interpreter state (the user’s namespace); it does not deal with input buffering or prompting or input file naming (the filename is always passed in explicitly). The optional locals argument specifies the dictionary in which code will be ...
python.library.code#code.InteractiveInterpreter
InteractiveInterpreter.runcode(code) Execute a code object. When an exception occurs, showtraceback() is called to display a traceback. All exceptions are caught except SystemExit, which is allowed to propagate. A note about KeyboardInterrupt: this exception may occur elsewhere in this code, and may not always be cau...
python.library.code#code.InteractiveInterpreter.runcode
InteractiveInterpreter.runsource(source, filename="<input>", symbol="single") Compile and run some source in the interpreter. Arguments are the same as for compile_command(); the default for filename is '<input>', and for symbol is 'single'. One of several things can happen: The input is incorrect; compile_command()...
python.library.code#code.InteractiveInterpreter.runsource
InteractiveInterpreter.showsyntaxerror(filename=None) Display the syntax error that just occurred. This does not display a stack trace because there isn’t one for syntax errors. If filename is given, it is stuffed into the exception instead of the default filename provided by Python’s parser, because it always uses '...
python.library.code#code.InteractiveInterpreter.showsyntaxerror
InteractiveInterpreter.showtraceback() Display the exception that just occurred. We remove the first stack item because it is within the interpreter object implementation. The output is written by the write() method. Changed in version 3.5: The full chained traceback is displayed instead of just the primary tracebac...
python.library.code#code.InteractiveInterpreter.showtraceback
InteractiveInterpreter.write(data) Write a string to the standard error stream (sys.stderr). Derived classes should override this to provide the appropriate output handling as needed.
python.library.code#code.InteractiveInterpreter.write
codecs — Codec registry and base classes Source code: Lib/codecs.py This module defines base classes for standard Python codecs (encoders and decoders) and provides access to the internal Python codec registry, which manages the codec and error handling lookup process. Most standard codecs are text encodings, which enc...
python.library.codecs
codecs.backslashreplace_errors(exception) Implements the 'backslashreplace' error handling (for text encodings only): malformed data is replaced by a backslashed escape sequence.
python.library.codecs#codecs.backslashreplace_errors
codecs.BOM codecs.BOM_BE codecs.BOM_LE codecs.BOM_UTF8 codecs.BOM_UTF16 codecs.BOM_UTF16_BE codecs.BOM_UTF16_LE codecs.BOM_UTF32 codecs.BOM_UTF32_BE codecs.BOM_UTF32_LE These constants define various byte sequences, being Unicode byte order marks (BOMs) for several encodings. They are used in UTF-16...
python.library.codecs#codecs.BOM
codecs.BOM codecs.BOM_BE codecs.BOM_LE codecs.BOM_UTF8 codecs.BOM_UTF16 codecs.BOM_UTF16_BE codecs.BOM_UTF16_LE codecs.BOM_UTF32 codecs.BOM_UTF32_BE codecs.BOM_UTF32_LE These constants define various byte sequences, being Unicode byte order marks (BOMs) for several encodings. They are used in UTF-16...
python.library.codecs#codecs.BOM_BE
codecs.BOM codecs.BOM_BE codecs.BOM_LE codecs.BOM_UTF8 codecs.BOM_UTF16 codecs.BOM_UTF16_BE codecs.BOM_UTF16_LE codecs.BOM_UTF32 codecs.BOM_UTF32_BE codecs.BOM_UTF32_LE These constants define various byte sequences, being Unicode byte order marks (BOMs) for several encodings. They are used in UTF-16...
python.library.codecs#codecs.BOM_LE
codecs.BOM codecs.BOM_BE codecs.BOM_LE codecs.BOM_UTF8 codecs.BOM_UTF16 codecs.BOM_UTF16_BE codecs.BOM_UTF16_LE codecs.BOM_UTF32 codecs.BOM_UTF32_BE codecs.BOM_UTF32_LE These constants define various byte sequences, being Unicode byte order marks (BOMs) for several encodings. They are used in UTF-16...
python.library.codecs#codecs.BOM_UTF16
codecs.BOM codecs.BOM_BE codecs.BOM_LE codecs.BOM_UTF8 codecs.BOM_UTF16 codecs.BOM_UTF16_BE codecs.BOM_UTF16_LE codecs.BOM_UTF32 codecs.BOM_UTF32_BE codecs.BOM_UTF32_LE These constants define various byte sequences, being Unicode byte order marks (BOMs) for several encodings. They are used in UTF-16...
python.library.codecs#codecs.BOM_UTF16_BE
codecs.BOM codecs.BOM_BE codecs.BOM_LE codecs.BOM_UTF8 codecs.BOM_UTF16 codecs.BOM_UTF16_BE codecs.BOM_UTF16_LE codecs.BOM_UTF32 codecs.BOM_UTF32_BE codecs.BOM_UTF32_LE These constants define various byte sequences, being Unicode byte order marks (BOMs) for several encodings. They are used in UTF-16...
python.library.codecs#codecs.BOM_UTF16_LE
codecs.BOM codecs.BOM_BE codecs.BOM_LE codecs.BOM_UTF8 codecs.BOM_UTF16 codecs.BOM_UTF16_BE codecs.BOM_UTF16_LE codecs.BOM_UTF32 codecs.BOM_UTF32_BE codecs.BOM_UTF32_LE These constants define various byte sequences, being Unicode byte order marks (BOMs) for several encodings. They are used in UTF-16...
python.library.codecs#codecs.BOM_UTF32
codecs.BOM codecs.BOM_BE codecs.BOM_LE codecs.BOM_UTF8 codecs.BOM_UTF16 codecs.BOM_UTF16_BE codecs.BOM_UTF16_LE codecs.BOM_UTF32 codecs.BOM_UTF32_BE codecs.BOM_UTF32_LE These constants define various byte sequences, being Unicode byte order marks (BOMs) for several encodings. They are used in UTF-16...
python.library.codecs#codecs.BOM_UTF32_BE
codecs.BOM codecs.BOM_BE codecs.BOM_LE codecs.BOM_UTF8 codecs.BOM_UTF16 codecs.BOM_UTF16_BE codecs.BOM_UTF16_LE codecs.BOM_UTF32 codecs.BOM_UTF32_BE codecs.BOM_UTF32_LE These constants define various byte sequences, being Unicode byte order marks (BOMs) for several encodings. They are used in UTF-16...
python.library.codecs#codecs.BOM_UTF32_LE
codecs.BOM codecs.BOM_BE codecs.BOM_LE codecs.BOM_UTF8 codecs.BOM_UTF16 codecs.BOM_UTF16_BE codecs.BOM_UTF16_LE codecs.BOM_UTF32 codecs.BOM_UTF32_BE codecs.BOM_UTF32_LE These constants define various byte sequences, being Unicode byte order marks (BOMs) for several encodings. They are used in UTF-16...
python.library.codecs#codecs.BOM_UTF8
Codec.decode(input[, errors]) Decodes the object input and returns a tuple (output object, length consumed). For instance, for a text encoding, decoding converts a bytes object encoded using a particular character set encoding to a string object. For text encodings and bytes-to-bytes codecs, input must be a bytes obj...
python.library.codecs#codecs.Codec.decode
Codec.encode(input[, errors]) Encodes the object input and returns a tuple (output object, length consumed). For instance, text encoding converts a string object to a bytes object using a particular character set encoding (e.g., cp1252 or iso-8859-1). The errors argument defines the error handling to apply. It defaul...
python.library.codecs#codecs.Codec.encode
class codecs.CodecInfo(encode, decode, streamreader=None, streamwriter=None, incrementalencoder=None, incrementaldecoder=None, name=None) Codec details when looking up the codec registry. The constructor arguments are stored in attributes of the same name: name The name of the encoding. encode decode The ...
python.library.codecs#codecs.CodecInfo
encode decode The stateless encoding and decoding functions. These must be functions or methods which have the same interface as the encode() and decode() methods of Codec instances (see Codec Interface). The functions or methods are expected to work in a stateless mode.
python.library.codecs#codecs.CodecInfo.decode
encode decode The stateless encoding and decoding functions. These must be functions or methods which have the same interface as the encode() and decode() methods of Codec instances (see Codec Interface). The functions or methods are expected to work in a stateless mode.
python.library.codecs#codecs.CodecInfo.encode
incrementalencoder incrementaldecoder Incremental encoder and decoder classes or factory functions. These have to provide the interface defined by the base classes IncrementalEncoder and IncrementalDecoder, respectively. Incremental codecs can maintain state.
python.library.codecs#codecs.CodecInfo.incrementaldecoder
incrementalencoder incrementaldecoder Incremental encoder and decoder classes or factory functions. These have to provide the interface defined by the base classes IncrementalEncoder and IncrementalDecoder, respectively. Incremental codecs can maintain state.
python.library.codecs#codecs.CodecInfo.incrementalencoder
name The name of the encoding.
python.library.codecs#codecs.CodecInfo.name
streamwriter streamreader Stream writer and reader classes or factory functions. These have to provide the interface defined by the base classes StreamWriter and StreamReader, respectively. Stream codecs can maintain state.
python.library.codecs#codecs.CodecInfo.streamreader
streamwriter streamreader Stream writer and reader classes or factory functions. These have to provide the interface defined by the base classes StreamWriter and StreamReader, respectively. Stream codecs can maintain state.
python.library.codecs#codecs.CodecInfo.streamwriter
codecs.decode(obj, encoding='utf-8', errors='strict') Decodes obj using the codec registered for encoding. Errors may be given to set the desired error handling scheme. The default error handler is 'strict' meaning that decoding errors raise ValueError (or a more codec specific subclass, such as UnicodeDecodeError). ...
python.library.codecs#codecs.decode
codecs.encode(obj, encoding='utf-8', errors='strict') Encodes obj using the codec registered for encoding. Errors may be given to set the desired error handling scheme. The default error handler is 'strict' meaning that encoding errors raise ValueError (or a more codec specific subclass, such as UnicodeEncodeError). ...
python.library.codecs#codecs.encode
codecs.EncodedFile(file, data_encoding, file_encoding=None, errors='strict') Return a StreamRecoder instance, a wrapped version of file which provides transparent transcoding. The original file is closed when the wrapped version is closed. Data written to the wrapped file is decoded according to the given data_encodi...
python.library.codecs#codecs.EncodedFile
codecs.getdecoder(encoding) Look up the codec for the given encoding and return its decoder function. Raises a LookupError in case the encoding cannot be found.
python.library.codecs#codecs.getdecoder
codecs.getencoder(encoding) Look up the codec for the given encoding and return its encoder function. Raises a LookupError in case the encoding cannot be found.
python.library.codecs#codecs.getencoder
codecs.getincrementaldecoder(encoding) Look up the codec for the given encoding and return its incremental decoder class or factory function. Raises a LookupError in case the encoding cannot be found or the codec doesn’t support an incremental decoder.
python.library.codecs#codecs.getincrementaldecoder
codecs.getincrementalencoder(encoding) Look up the codec for the given encoding and return its incremental encoder class or factory function. Raises a LookupError in case the encoding cannot be found or the codec doesn’t support an incremental encoder.
python.library.codecs#codecs.getincrementalencoder
codecs.getreader(encoding) Look up the codec for the given encoding and return its StreamReader class or factory function. Raises a LookupError in case the encoding cannot be found.
python.library.codecs#codecs.getreader
codecs.getwriter(encoding) Look up the codec for the given encoding and return its StreamWriter class or factory function. Raises a LookupError in case the encoding cannot be found.
python.library.codecs#codecs.getwriter
codecs.ignore_errors(exception) Implements the 'ignore' error handling: malformed data is ignored and encoding or decoding is continued without further notice.
python.library.codecs#codecs.ignore_errors
class codecs.IncrementalDecoder(errors='strict') Constructor for an IncrementalDecoder instance. All incremental decoders 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 IncrementalDecoder may impleme...
python.library.codecs#codecs.IncrementalDecoder
decode(object[, final]) Decodes object (taking the current state of the decoder into account) and returns the resulting decoded object. If this is the last call to decode() final must be true (the default is false). If final is true the decoder must decode the input completely and must flush all buffers. If this isn’...
python.library.codecs#codecs.IncrementalDecoder.decode
getstate() Return the current state of the decoder. This must be a tuple with two items, the first must be the buffer containing the still undecoded input. The second must be an integer and can be additional state info. (The implementation should make sure that 0 is the most common additional state info.) If this add...
python.library.codecs#codecs.IncrementalDecoder.getstate
reset() Reset the decoder to the initial state.
python.library.codecs#codecs.IncrementalDecoder.reset
setstate(state) Set the state of the decoder to state. state must be a decoder state returned by getstate().
python.library.codecs#codecs.IncrementalDecoder.setstate
class codecs.IncrementalEncoder(errors='strict') Constructor for an IncrementalEncoder instance. All incremental encoders 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 IncrementalEncoder may impleme...
python.library.codecs#codecs.IncrementalEncoder
encode(object[, final]) Encodes object (taking the current state of the encoder into account) and returns the resulting encoded object. If this is the last call to encode() final must be true (the default is false).
python.library.codecs#codecs.IncrementalEncoder.encode
getstate() Return the current state of the encoder which must be an integer. The implementation should make sure that 0 is the most common state. (States that are more complicated than integers can be converted into an integer by marshaling/pickling the state and encoding the bytes of the resulting string into an int...
python.library.codecs#codecs.IncrementalEncoder.getstate
reset() Reset the encoder to the initial state. The output is discarded: call .encode(object, final=True), passing an empty byte or text string if necessary, to reset the encoder and to get the output.
python.library.codecs#codecs.IncrementalEncoder.reset
setstate(state) Set the state of the encoder to state. state must be an encoder state returned by getstate().
python.library.codecs#codecs.IncrementalEncoder.setstate
codecs.iterdecode(iterator, encoding, errors='strict', **kwargs) Uses an incremental decoder to iteratively decode the input provided by iterator. This function is a generator. The errors argument (as well as any other keyword argument) is passed through to the incremental decoder. This function requires that the cod...
python.library.codecs#codecs.iterdecode
codecs.iterencode(iterator, encoding, errors='strict', **kwargs) Uses an incremental encoder to iteratively encode the input provided by iterator. This function is a generator. The errors argument (as well as any other keyword argument) is passed through to the incremental encoder. This function requires that the cod...
python.library.codecs#codecs.iterencode
codecs.lookup(encoding) Looks up the codec info in the Python codec registry and returns a CodecInfo object as defined below. Encodings are first looked up in the registry’s cache. If not found, the list of registered search functions is scanned. If no CodecInfo object is found, a LookupError is raised. Otherwise, th...
python.library.codecs#codecs.lookup
codecs.lookup_error(name) Return the error handler previously registered under the name name. Raises a LookupError in case the handler cannot be found.
python.library.codecs#codecs.lookup_error
codecs.namereplace_errors(exception) Implements the 'namereplace' error handling (for encoding with text encodings only): the unencodable character is replaced by a \N{...} escape sequence. New in version 3.5.
python.library.codecs#codecs.namereplace_errors
codecs.open(filename, mode='r', encoding=None, errors='strict', buffering=-1) Open an encoded file using the given mode and return an instance of StreamReaderWriter, providing transparent encoding/decoding. The default file mode is 'r', meaning to open the file in read mode. Note Underlying encoded files are always ...
python.library.codecs#codecs.open
codecs.register(search_function) Register a codec search function. Search functions are expected to take one argument, being the encoding name in all lower case letters with hyphens and spaces converted to underscores, and return a CodecInfo object. In case a search function cannot find a given encoding, it should re...
python.library.codecs#codecs.register
codecs.register_error(name, error_handler) Register the error handling function error_handler under the name name. The error_handler argument will be called during encoding and decoding in case of an error, when name is specified as the errors parameter. For encoding, error_handler will be called with a UnicodeEncode...
python.library.codecs#codecs.register_error
codecs.replace_errors(exception) Implements the 'replace' error handling (for text encodings only): substitutes '?' for encoding errors (to be encoded by the codec), and '\ufffd' (the Unicode replacement character) for decoding errors.
python.library.codecs#codecs.replace_errors
class codecs.StreamReader(stream, errors='strict') Constructor for a StreamReader instance. All stream readers 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 objec...
python.library.codecs#codecs.StreamReader
read([size[, chars[, firstline]]]) Decodes data from the stream and returns the resulting object. The chars argument indicates the number of decoded code points or bytes to return. The read() method will never return more data than requested, but it might return less, if there is not enough available. The size argume...
python.library.codecs#codecs.StreamReader.read
readline([size[, keepends]]) Read one line from the input stream and return the decoded data. size, if given, is passed as size argument to the stream’s read() method. If keepends is false line-endings will be stripped from the lines returned.
python.library.codecs#codecs.StreamReader.readline
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 decode() 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.
python.library.codecs#codecs.StreamReader.readlines
reset() Resets the codec buffers used for keeping internal state. Note that no stream repositioning should take place. This method is primarily intended to be able to recover from decoding errors.
python.library.codecs#codecs.StreamReader.reset
class codecs.StreamReaderWriter(stream, Reader, Writer, errors='strict') 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 th...
python.library.codecs#codecs.StreamReaderWriter
class codecs.StreamRecoder(stream, encode, decode, Reader, Writer, errors='strict') 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. Yo...
python.library.codecs#codecs.StreamRecoder
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 objec...
python.library.codecs#codecs.StreamWriter
reset() Resets the codec buffers used for keeping internal 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.
python.library.codecs#codecs.StreamWriter.reset
write(object) Writes the object’s contents encoded to the stream.
python.library.codecs#codecs.StreamWriter.write