\U0001F919
时间: 2024-01-29 14:10:43 浏览: 143
以下是两种处理Unicode转义字符的方法:
1. 使用unicode_escape解码字符串:
```python
print('\\U0001F919'.encode('utf8').decode('unicode_escape')) # 输出:🤙
```
2. 从文件中读取并处理Unicode转义字符:
```python
emos = []
with open('assets/out.txt', 'r', encoding='utf-8') as emojis:
_emos = emojis.readlines()
for _emo in _emos:
_emo = _emo[:-1]
emos.append(_emo.encode('utf8').decode('unicode_escape'))
print(emos) # 输出:['🤙']
```
阅读全文