来自Python Unicode方法
>>> s = "a\xac\u1234\u20ac\U00008000"
... # ^^^^ two-digit hex escape
... # ^^^^^^ four-digit Unicode escape
... # ^^^^^^^^^^ eight-digit Unicode escape
>>> print(s)
a¬ሴ€耀是否可以用十六进制转义来表示Unicode 4转义序列"\u20ac"?例如,为什么"\x20\xac"不能工作?
转义序列\U00008000"也是如此。是否可以只使用十六进制或Unicode 4转义来编写?
发布于 2022-09-30 18:43:29
>>> "\u20ac"
'€'
>>> "\x20\xac"
' ¬'
>>> "\U00008000"
'耀'
>>> "\u8000"
'耀'
>>> "\U00008000" == "\u8000"
True如果你还有更多的问题,请告诉我们;)
https://stackoverflow.com/questions/73912570
复制相似问题