How to print a variable containing a Unicode character?

print u'\u0D05' a = '\u0D05' print a 

print a gives \u0D05 as output, but I want to print the unicode character that it represents, which is เด… . How can I achieve this?

+6
source share
1 answer

The output \u does not make sense inside a string other than unicode. You need to do a = u'\u0D05' .

If you say you get the string from another place and you need to interpret the escape files in unicode, then print a.decode('unicode-escape')

+9
source

Source: https://habr.com/ru/post/945045/


All Articles