2013-03-10 8 views

Odpowiedz

77
>>> 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! 
+0

Ale ciąg, który pokazałeś w przykładzie, \\ u03c0 nie \ u03c0 ... –

+2

To jest po prostu jego wydrukowane –

+0

również ciekawe dlaczego napisałeś '\\', ale nie ' \ ", nie jest \" wyprowadza to samo z twoim kodem? – zhangxaochen

Powiązane problemy