Cherry Wu
Cherry Wu

Reputation: 4074

Python - How to convert Unicode code point to the character

I'm trying to convert english character into Star Wars Aurebesh characters. I found the unicode code assignment for Aurebesh characters here: http://www.kreativekorp.com/ucsur/charts/aurebesh.htm

So with code point such as "U+E890", can I print out the Aurebesh character in python?

Upvotes: 1

Views: 766

Answers (2)

Simas Joneliunas
Simas Joneliunas

Reputation: 3118

In python3 you can do it by using escape char: print('\ue890')

EDIT: Adding this to the answer as it involved a small discussion in the comments.

In python2.7 you need to add extra u in front of the string to turn it into unicode string (courtesy of Matt Clark): print u'\ue890'

Upvotes: 0

blhsing
blhsing

Reputation: 106543

print('\ue890') will do the job.

Upvotes: 1

Related Questions