Portál AbcLinuxu, 9. května 2025 19:30
>>> import unicodedata >>> print unicodedata.normalize('NFD', u'ő') ő >>> print unicodedata.normalize('NFD', u'ø') ø
$ perl -Mutf8 -le '$_="Hungarian ő, Scandinavian ø";tr/őø/o/;print' Hungarian o, Scandinavian o
def cleanString(what): '''Gets rid of letters which are not in English alphabet''' assert type(what) == unicode normalized = unicodedata.normalize('NFKD', what) output = '' for c in normalized: if not unicodedata.combining(c): output += c return output
Tiskni
Sdílej:
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.