[Python-Dev] unicode/string asymmetries

Martin v. Loewis martin@v.loewis.de
Wed, 9 Jan 2002 23:15:24 +0100


> How can I do the equivalent of
>   u"some string"
> in terms of
>   unicode("some string", encoding)

Again, what do you need that for? If there won't be any escape
sequences or non-ASCII characters inside, then

   unicode("some string", "ascii")

will work fine. In the general case,

   unicode("some string", "unicode-escape")

should work.

Regards,
Martin