Удаление юникода \u2026 как символов в строке в python2.7
У меня есть строка в Python2.7, как это,
This is some \u03c0 text that has to be cleaned\u2026! it\u0027s annoying!
Как мне преобразовать это в это,
This is some text that has to be cleaned! its annoying!
1 ответ
Решение
>>> s
'This is some \\u03c0 text that has to be cleaned\\u2026! it\\u0027s annoying!'
>>> print(s.decode('unicode_escape').encode('ascii','ignore'))
This is some text that has to be cleaned! it's annoying!