我下载了一份Facebook信息数据集,格式如下:
f\u00c3\u00b8rste student
这里应该是“første student”,但我似乎无法正确解码。
我尝试过:
str = 'f\u00c3\u00b8rste student'
print(str)
# 'første student'
str = 'f\u00c3\u00b8rste student'
print(str.encode('utf-8'))
# b'f\xc3\x83\xc2\xb8rste student'
但它没有起作用。
'ø'
is'\u00f8'
- timgeb# -*- coding: utf-8 -*-
只是指定源代码文件的编码方式。 - quant\xC3\xb8
也是。有了这个,答案就很明显了。 - quant