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-June/015389.html below:

[Python-Dev] Adding .decode() method to Unicode

[Python-Dev] Adding .decode() method to UnicodeBarry A. Warsaw barry@digicool.com
Tue, 12 Jun 2001 14:35:10 -0400
>>>>> "MvL" == Martin v Loewis <martin@loewis.home.cs.tu-berlin.de> writes:

    MvL> What is the type of parts[3] here? If it is a plain string,
    MvL> it is already possible:

    >> 'SGVsbG8=\n'.decode("base64")
    MvL> 'Hello'

But only in Python 2.2a0 currently, right?  And yes, the type is plain
string.

    MvL> I doubt you'd ever have a Unicode string that represents a
    MvL> base64-encoded byte string, and if you had, .decode would
    MvL> probably do the wrong thing:

    >> import codecs enc,dec,_,_ = codecs.lookup("base64")
    >> dec(u'SGVsbG8=\n')
    MvL> ('Hello', 9)

    MvL> Note that this returns a byte string, not a Unicode string.

I trust you on that. ;)  I've only played with this tangentially since
this thread cropped up.

-Barry



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