我有这段代码:
count_words = input("Put in your favorite word, and then press the hidden button(SPOILER: IT'S ENTER!):")
split_Geonotes = Geonotes.replace ("\n", " "). split(".")
print (" Total number of words:", len (Geonotes.split() ) )
print("Total number of sentences:", len (Geonotes.split(".") ) )
print("Total number of periods:", Geonotes.count(".") )
print("you typed:", count_words)
print("There are:", Geonotes.count(count_words), "instances of", count_words)
split_Geonotes.sort()
print(split_Geonotes)
print("The number of elements in the HTML code:", len (split_Geonotes) )
for i in range(10):
print(i)
print(split_Geonotes(i) )
这导致了标题中显示的错误。 根据打印时发生的全部错误(一) 有人能告诉我怎么了吗? 谢谢您。
看起来您正试图将列表
split_Geonotes
索引到最后一行。为此,您需要使用方括号[...]
:括号
(...)
用于调用函数;当您将它们放在split_Geonotes
之后时,Python将尝试调用列表:相关问题 更多 >
编程相关推荐