How do I convert a unicode to a string at the Python level?

Posted by Thierry Lam on Stack Overflow See other posts from Stack Overflow or by Thierry Lam
Published on 2010-05-06T17:23:22Z Indexed on 2010/05/06 17:28 UTC
Read the original article Hit count: 172

Filed under:

The following unicode and string can exist on their own if defined explicitly:

>>> value_str='Andr\xc3\xa9'
>>> value_uni=u'Andr\xc3\xa9'

If I only have u'Andr\xc3\xa9' assigned to a variable like above, how do I convert it to 'Andr\xc3\xa9' in Python 2.5 or 2.6?

© Stack Overflow or respective owner

Related posts about python