Character to unicode

myname='John Doe'
a = ''
for index in range(len(myname)):
    a += 'U'+(format(ord(myname[index]), '04x')) + ' '
    #a = U004a U006f U0068 U006e U0020 U0044 U006f U0065
print(a)

Leave a Reply

Your email address will not be published. Required fields are marked *