Supprimer les accents


#! /usr/bin/env python3
# coding : utf-8


import unicodedata


def clean(string):
    y = unicodedata.normalize('NFKD', chaine).encode('ASCII', 'ignore')
    return y.decode("utf-8")


chaine = u"mà chàîne âvèc dès càräctère spéciâüx"
cleaned_chaine = clean(chaine)
print(type(cleaned_chaine))
print(cleaned_chaine)

Partagez sur les réseaux sociaux

Commentaires