Google colab - TypeError:“列表”对象不可调用

问题描述 投票:0回答:1

我不明白我在 google colab 中遇到的错误... 如果有人可以帮助我

user_str = input("Please insert a sentence : ")
user_letter = input("Please insert a letter to remove from the sentence : ")
liste_char = list(user)

if user_letter in liste_char :
    liste_char.remove(user_letter)                      

counter = liste_char.count(user_letter)

print("There are still {} copies of {} in the list".format(counter, user_letter))`
python string list typeerror callable
1个回答
0
投票

在第三行,您正在调用一个未定义的变量“user”。 我相信你的意思是写“user_str”。 另外,最后一行似乎有一个反勾号。这看起来像是复制代码时的拼写错误,但我想我会指出来

© www.soinside.com 2019 - 2024. All rights reserved.