转换字节字符串为Unicode字符串
我有一段代码如下:
a = "\u0432"
b = u"\u0432"
c = b"\u0432"
d = c.decode('utf8')
print(type(a), a)
print(type(b), b)
print(type(c), c)
print(type(d), d)
输出结果为:
в
в
b'\\u0432'
\u0432
为什么在后一种情况下我看到的是字符的代码,而不是字符本身?
如何将字节字符串转换为Unicode字符串,以便在输出时看到字符而不是字符代码?