Q:

Python Unicode, have unicode number in normal string, want to print unicode

Im using IDLE on windows 7. When I run the following code
uni = u"\u4E0D"
binary = uni.encode("utf-8")
print binary

It prints the unicode character with number 4E0D correctly. But here I have to hardcode the unicode number manually. Lets say I have a normal string format variable:
s="4E0D"

How do I convert this to the unicode character? Ie I want to do something like the following pseudocode
s="4E0D"
uni=u"\u"+s

Thanks!

A:

s = '4e0d'
c = unichr(int(s, 16))

