我有這個數組AR,我需要從它的每個單詞中刪除元音。我如何去做這件事?我已經嘗試過.pop和.remove,但這不起作用。如何從數組中的字符串中刪除字母?
ar=["house","place","oipa"]
def noWovels(inList):
wovels=["a","e","i","o","u","y"]
for word in inList:
for letter in word:
if letter in wovels:
inList[word].remove(letter) ?
inList.replace(letter,"") ?
word.pop(letter) ?
return inList
print(noWovels(ar))
重複:http://stackoverflow.com/ q/3559559/1110928 – apnorton
由於這個問題是重複的,請看原始問題。另外,'ar'不是*數組,它是一個列表。 – daniel451