testo = "Era una notte buia e tempestosa, molto tempestosa"

parole = testo.split()

from collections import Counter

conta_parole = Counter(parole)


Nota: soluzione con difetti, per esempio la punteggiatura va tolta.
_______________________________________________
Python mailing list
[email protected]
https://lists.python.it/mailman/listinfo/python

Rispondere a