A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2001-May/014801.html below:

[Python-Dev] Easy codec access

[Python-Dev] Easy codec access [Python-Dev] Easy codec accessM.-A. Lemburg mal@lemburg.com
Tue, 15 May 2001 14:10:16 +0200
I've just checked in a set of patches which implement the new
.decode() method along with a couple of useful codecs.

You can now do things like these:

>>> "abc".encode('zlib').encode('base64')
'eJxLTEoGAAJNASc=\n'
>>> _.decode('base64').decode('zlib')
'abc'

>>> "abcäöü".decode('latin-1')
u'abc\xe4\xf6\xfc'

>>> "abcäöü".decode('latin-1').encode('latin-1')
'abc\xe4\xf6\xfc'

>>> "Hello World !".encode('rot13')
'Uryyb Jbeyq !'

So the overall codec experience should be a much better one
now.

To see just how easy it is to write codecs, please have
a look at the string codecs I added in this patch (e.g.
zlib_codec.py or hex_codec.py). I am pretty sure that there
are a lot more useful things in the standard lib which could
benefit from these easy-to-use interfaces.

-- 
Marc-Andre Lemburg
______________________________________________________________________
Company & Consulting:                           http://www.egenix.com/
Python Software:                        http://www.lemburg.com/python/



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4