String Handling

The modules in this section are used for string processing.

codecs

The codecs module provides an interface for accessing different string encoding and decoding functions (codecs) as well as a collection of base classes that can be used to define new codecs. The following functions are available:

						register(search_function)
					

Registers a new codec search function. This function should take a single argument in the form of an encoding string (for example, 'utf-8') and return a tuple of functions (encoder , decoder , streamreader , streamwriter ).

						lookup(encoding)
					

Looks up a codec in the codec registry. encoding is a string such as 'utf-8'. Returns a tuple of functions (encoder , decoder , streamreader , streamwriter ). Internally, ...

Get Python Essential Reference, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.