所以我一直试图从python中的Word中删除元音。根据编程逻辑,它应该做得很好。找不到问题。
def disemvowel(word):
b = ['a', 'e', 'i', 'o', 'u']
try:
a = list(word)
except ValueError:
print("{} is not a word.".format(word))
else:
for words in a:
for vowels in b:
if words.lower() == vowels:
a.remove(words)
word = ", ".join(a)
return word
m = input("Enter word:")
print(disemvowel(m))