Discuss / Python / 请教:

请教:

Topic source

aiyaxiaoya

#1 Created at ... [Delete] [Delete and Lock User]

'\u4e2d\u6587'是根据'中文'各自对应的编码值转换成十六进制得到的, 那么这里,'中文'.encode('utf-8')转换为b'\xe4\xb8\xad\xe6\x96\x87'这里的bytes是怎么得来的?与‘中文’对应的十六进制数不符啊?

Lotus丨bobo

#2 Created at ... [Delete] [Delete and Lock User]

\u4e2d\u6587这个是Unicode编码下"中文"对应的十六进制编码,2个字节; \xe4\xb8\xad\xe6\x96\x87这个是utf-8编码下"中文"对应的十六进制编码,6个字节


  • 1

Reply