This topic created in 3380 days ago, the information mentioned may be changed or developed.
非 ASCII Unicode 字符可以以十六进制转移(\xNN )编写到一个字符串中。
请问程序如何写呢?
谢谢
4 replies • 2017-08-18 15:57:34 +08:00
 |
|
就这么写
|
 |
|
你的意思是,有一段\x 转义的字符串,你要转换成 bytes?
|
 |
|
完全不知道在说什么,Orz,我猜是这个意思?
```python3 s = "Hello\n 中文\nWorld" ss = ''.join('\\x%02X' % b for b in s.encode('utf-8')) print(ss) ```
|
 |
|
当然用键盘直接敲\xNN 啊……对,不要用马克笔往屏幕上画
|