vowels = 'aeiou'
# take input from the user
ip_str = raw_input("Enter a string: ")
# make it suitable for caseless comparisions
ip_str = ip_str.casefold()
# make a dictionary with each vowel a key and value 0
count = {}.fromkeys(vowels,0)
# count the vowels
for char in ip_str:
if char in count:
count[char] += 1
print(count)
错误:
Line - ip_str = ip_str.casefold()
AttributeError: 'str' object has no attribute 'casefold'