Как разделить эту строку с помощью python?

У меня есть строки, которые выглядят как в этом примере: "AAABBBCDEEEEBBBAA"

В строке можно использовать любой символ.

Я хочу разбить его на список вроде: ['AAA','BBB','C','D','EEEE','BBB','AA']

so every continuous stretch of the same characters goes to separate element of the split list.

I know that I can iterate over characters in the string, check every i and i-1 pair if they contain the same character, etc. but is there a more simple solution out there?

8
задан jan 15 October 2010 в 08:44
поделиться