我有一個單詞列表。我想過濾掉沒有最小長度的單詞。我嘗試過濾器,但顯示一些錯誤。我的代碼是使用過濾器時將兩個參數傳遞給函數
def words_to_integer(x,y):
return len(x)> y
print("enter the list of words : ")
listofwords = [ str(x) for x in input().split()] #list of words
minimumlength = print("enter the length ")
z = list(filter(words_to_integer,(listofwords,minimumlength)))
print("words with length greater than ",minimumlength ,"are" ,z)
誤差
z = list(filter(words_to_integer,(listofwords,minimumlength)))
TypeError: words_to_integer() missing 1 required positional argument: 'y'