0

I am trying to convert a custom string to a Unicode character and display its integer value. For example, the following line should give output as 134.

ord('\x86') 

Now I want to get output differently. Let's say I want to concatenate each individual symbol i.e. '\' , 'x', '8', '6' and generate a string say t. So,

t = '\x86'

But, Python is not considering t as a string of length 1. How can I achieve this task?

Note: The main task is to read a file that contains a chain of Unicode characters. After reading the file, I stored the character in a list. For example

lst = ["\x86", "\x92", "\x83" ... ]

Each of the list elements is not being considered as a single character but a string of 4 characters.

1 Answers1

0

Try running:

t=eval("\""+t+"\"")

To convert it.