[python] Count Vowels in String Python

You could use regex and dict comprehension:

import re
s = "aeiouuaaieeeeeeee"

The regex function findall() returns a list containing all matches

Here x is the key and the lenght of the list returned by the regex is the count of each vowel in this string, note that regex will find any character you introduce into the "aeiou" string.

foo = {x: len(re.findall(f"{x}", s)) for x in "aeiou"}
print(foo)

returns:

{'a': 3, 'e': 9, 'i': 2, 'o': 1, 'u': 2}