python:x和\u之间的字符差异

2024-10-05 14:28:56 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图理解使用十六进制的unicode和字节表示法。因此,在python中,我尝试了以下方法

> 'I am a string Ņ'.encode('utf-8')
> b'I am a string \xc5\x85'

在这里我明白了\xc5\x85这个表述的含义。Ņ的实际unicode是\u0145

如何\u0145 = \xc5\x85


Tags: 方法string字节unicodeamutfencode表示法