基本上我想做的是print u'\u1001',但我不想对1001 进行硬编码。有没有办法为此使用变量或字符串?此外,如果我可以在将输出用作输入时再次检索此代码,那就太好了。
请您参考如下方法:
根据 unicode 上的 python 文档(位于 Here ):
One-character Unicode strings can also be created with the unichr() built-in function, which takes integers and returns a Unicode string of length 1 that contains the corresponding code point. The reverse operation is the built-in ord() function that takes a one-character Unicode string and returns the code point value:
unichr(40960)
字符的结果: 你'\ua000'
