Python codecs Library
The purpose of this module is Encoding and decoding i.e. conversion of the texts between different representations.
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.
The next two functions defined here are
1. codecs.getreader(encoding)
2. codecs.getwriter(encoding)
codecs.getreader(encoding):
This function looks up the codec for the given encoding and return its StreamReader class or the factory function.
The StreamWriter and StreamReader classes are classes in codec library, which provide generic working interfaces which can be used to implement new encoding submodules very easily.
This also raises a LookupError in case the encoding cannot be found.
codecs.getwriter(encoding):
This function looks up the codec for the given encoding and return its StreamWriter class or the factory function.
This also raises a LookupError in case the encoding cannot be found.
Comments