1import unicodedata
2
3def strip_accents(text):
4
5 try:
6 text = unicode(text, 'utf-8')
7 except NameError: # unicode is a default on python 3
8 pass
9
10 text = unicodedata.normalize('NFD', text)\
11 .encode('ascii', 'ignore')\
12 .decode("utf-8")
13
14 return str(text)
15
16s = strip_accents('àéêöhello')
17
18print s
19