如何在python中滑动字符串?

如何在python中滑动字符串?,python,slide,Python,Slide,我想滑动字符串,但程序输出出错 Traceback (most recent call last): File "<tmp 3>", line 28, in <module> print_hell(sentence) File "<tmp 3>", line 23, in print_hell print(i) TypeError: 'list' object is not callable '

我想滑动字符串,但程序输出出错

Traceback (most recent call last):
  File "<tmp 3>", line 28, in <module>
    print_hell(sentence)
  File "<tmp 3>", line 23, in print_hell
    print(i)
TypeError: 'list' object is not callable
'''

谢谢,

essay = "print the sentence with the word 'hell'. Even the word like 'hello' with hell in it. And even hellooo. Not this though "
list_of_sentences = essay.split(".")
for sentence in list_of_sentences:
    if "hell" in sentence.lower():
        print(sentence)
通过这种方式,你首先将文章转换成一个句子列表,然后检查列表中的每个句子是否包含字母“hell”的组合


通过这种方式,你首先将文章转换成一个句子列表,然后检查列表中的每个句子是否包含字母“hell”的组合

但这不会打印包含“hello”一词的句子,对吗(世界hello也有“hell”在它里面。我想写一篇大文章,而不是几句话。实际上,试试看,如果你通过它,它会打印“你好”。试试看,如果它有效,请接受我的回答,因为它仍然说“TypeError:“list”对象不可调用”在打印行上,我只是再次测试了一下,它对我有效…你没有改变任何东西?但这不会打印包含“hello”一词的句子,对吗(世界hello也有“hell”在它里面。我想为一篇大文章写这篇文章,而不仅仅是几句话。事实上,试试看,如果你通过它,它会打印“你好”。试试看,如果它有效,请接受我的答案,因为答案是正确的。打印行上仍然写着“TypeError:“list”object不可调用。我刚刚又测试了一次,它对我有效……你没有改变什么吗?
essay = "print the sentence with the word 'hell'. Even the word like 'hello' with hell in it. And even hellooo. Not this though "
list_of_sentences = essay.split(".")
for sentence in list_of_sentences:
    if "hell" in sentence.lower():
        print(sentence)