2017-06-08 2 views

Antwort

1
import unidecode 
somestring = "àéêöhello" 

#convert plain text to utf-8 
u = unicode(somestring, "utf-8") 
#convert utf-8 to normal text 
print unidecode.unidecode(u) 

Ausgang

aeeohello

1

Hallo Ganesh Verwenden Sie den Code unten.

Es funktioniert für mich!

import unicodedata 

def strip_accents(text): 

try: 
    text = unicode(text, 'utf-8') 
except NameError: # unicode is a default on python 3 
    pass 
text = unicodedata.normalize('NFD', text) 
text = text.encode('ascii', 'ignore') 
text = text.decode("utf-8") 
return str(text) 
s = strip_accents('àéêöhello') 

print s 
+0

Funktioniert perfekt. Vielen Dank. –

Verwandte Themen