Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Second - added use of combining() solution in Clear category for Remove Accents by robertabegg
from unicodedata import normalize, combining
def checkio(in_string):
"""
Remove accented characters from in_string.
Unicode accented chars can be represented by two characters that combine
to a single printable char, or by a single character value.
Normalize to NFD converts all accented characters to the base character and
the computational accent char.
The accent characters are examples of combining chars.
"""
r = [c for c in normalize("NFD", in_string) if not combining(c)]
return "".join(r)
# These "asserts" using only for self-checking and not necessary for auto-testing
if __name__ == '__main__':
assert checkio(u"eéè") == u"eee"
assert checkio(u"préfèrent") == u"preferent"
assert checkio(u"loài trăn lớn") == u"loai tran lon"
print('Done')
Sept. 16, 2021