[Python] How to count correctly letters with diacritics in text?

Discussão em 'Python' iniciado por Stack, Agosto 27, 2025.

  1. Stack

    Stack Membro Participativo

    I want to find frequency of different letters in a text, and some of them use diacritics. As example the text uses both 'å' and 'ą̊ '(U+00E5 U+0328) and the frequency needs to be counted for separately.

    How do I do that?

    I've tried using Counter collection, open the file using utf8 format, split the text string using both text.split() and list(text), but python still counts 'å' and 'ą̊ ' as same letter!

    Continue reading...

Compartilhe esta Página