Python codecs Library getencoder and getdecoder functions














































Python codecs Library getencoder and getdecoder functions



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.

codecs.getencoder(encoding):

Lookup the codecs for the given encoding and return its encoder function.
This function is returned as an object, as we know that in Python, functions behave like any other object, such as an int or a list. That means that you can use functions as arguments to other functions, store functions as dictionary values, or return a function from another function. This leads to many powerful ways to use functions.
The encoder function which matches the argument passes is returned in the form of an object.
It raises a LookupError in case the encoding cannot be found.

    

codecs.getdecoder(encoding):

Lookup the codecs for the given encoding and return its decoder function.
Here also we receive the function as an object only, just like getencoder function.
It also raises a LookupError in case the encoding cannot be found.

    


More Articles of Arkaja Sharan:

Name Views Likes
Python codecs Library Error Handling schemes module functions 52 0
Python codecs Library Error Handler register_error and lookup_error functions 51 0
Python codecs Library Error Handlers 50 0
Python codecs Library open and EncodedFile functions 47 0
Python codecs Library iterencode and iterdecode functions 53 0
Python codecs Library register and unregister functions 44 0
Python codecs Library getreader and getwriter functions 51 0
Python codecs Library getincrementalencoder and getincrementaldecoder 42 0
Python codecs Library getencoder and getdecoder functions 47 0
Python Introduction to codecs Library 67 0
Python fcntl Library flock and lockf functions 49 0
Python fcntl Library fcntl and ioctl functions 66 0
Python Resource Library resource usage functions 64 0
Python Resource Library resource usage symbolic constants 52 0
Python Resource Library Resource Limit Functions 61 0
Python resource library resource limit symbolic constants 58 0
Python Introduction to Resource Library 44 0
Python stringprep Library in_table_d1 and in_table_d2 functions 50 0
Python stringprep Library in_table_c8 and in_table_c9 functions 57 0
Python stringprep Library in_table_c5 in_table_c6 and in_table_c7 functions 47 0
Python stringprep Library in_table_c3 and in_table_c4 functions 50 0
Python stringprep library in_table_c21 in_table_c22 and in_table_c21_c22 44 0
Python stringprep library functions in_table_c11 in_table_c12 and in_table_c11_c12 53 0
Python Introduction to stringprep Library 52 0
Python unicodedata library is_normalized unidata_version and ucd_3_2_0 52 0
Python Unicodedata Library functions normalize and decomposition 101 0
Python Unicodedata Library functions east_asian_width and mirrored 53 1
Python Unicodedata Library category bidirectional and combining functions 87 0
Introduction to Unicodedata library lookup and name functions 51 0
Unicode Library decimal digit and numeric functions 55 0
Introduction to Unicode Data library 0 0

Comments