Pb2Au wrote:
> On Sun, Nov 16, 2008 at 4:31 PM, Chris Rebert <[EMAIL PROTECTED]>: wrote:
>>
>>Already exists. Has for quite a while now:
>>
>>the_unicode = unicode(some_bytes, "name of encoding")
>
> I know that it had worked in the version 2.5, Python 3.0 rc2 doesn't
> seem to recognize it as a function.
>
> Python 3.0rc2 (r30rc2:67141, Nov 7 2008, 11:43:46) [MSC v.1500 32 bit
> (Intel)]
> on win32
> Type "help", "copyright", "credits" or "license" for more information.
>>>> unicode()
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> NameError: name 'unicode' is not defined
unicode becomes str in Py3k (as "type('')" will tell you).
bytes.decode() works as well.
Use str.encode() to go the other way.
Cheers,
Nick.
--
Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia
---------------------------------------------------------------
_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe:
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com