Reputation: 154
I have a file with data in Chinese language for instance i have a character 攻 and I want to find the utf-16 code of this character. how can i find it in python 3?
Upvotes: 1
Views: 134
Reputation: 6281
Use the ord function.
ord
print(hex(ord(u'攻')))
prints 0x653b
0x653b
Upvotes: 2