I have list of strings - or better 90% are literal stings But sometimes there is also octal encoded string
aL = ['literalString, XYZ','Verri\303\250res-le-buisson, IDF'] I am retrieveing list items from input (json file)
I need to convert it to utf-8
This works as intended:
x = b'Verri\303\250res-le-buisson, IDF'
print(f'{type(x)}')
print(x.decode('utf-8'))
<class 'bytes'>
Verrières-le-buisson, IDF
The problem is that I cannot find the way to prefix (use functionality) of 'b' to variable.
As I would need:
b'x.decode('utf-8')
Converting variable to bytes does not work properly (like bytes(x,'utf-8')).